Wednesday, 19 April 2017

Javascript terminology: do I (call / invoke / execute) a function?

Is there a difference to the mentioned verbs which are used in relation to functions ?

Initially, I thought they mean the same thing and people use it interchangeably. Now, I am not 100% sure. I feel that there is a chance I might be missing important piece of information when trying to understand code-related content. I also take a lot of notes, and I haven't been thinking much how to use those terms.

If I was to answer a million-dollar question on the differences between the three I would say:

  • 'function was invoked' - function has been triggered but does not necessarily returned results
  • 'function was executed' - function has been triggered and returned result
  • 'function was called' - function has been triggered within a function (hence we use term 'callback')

The above is just my gut feel. If someone asked me to explain some of my code line by line, I don't know which verbs would I use to describe it. I would probably randomize between the three to feel smart.

I tried to research this terminology but couldn't find any relevant information. Help much appreciated. Thanks !



via user7861743

No comments:

Post a Comment