You can create a new folder for this project or continue on with the last one from the previus exercise.

The structure of our html file remains the same.

copy the code and paste into app.js

Run the code by opening the index.html
After the creation phase and the execution context are created, the JavaScript engine runs the code now line by line. Interpreting converting and compiling the code.

On running the code, b is called, then a is logged and a is logged again.

What do you see?

The first time a is called it returns undefined and the second time we get Hello World

This is because the code is in execution phase. During the creation phase the var a was assigned the value undefined

And now in the execution phase a is returned as undefined.
The next line now asigns the the value Hello World to a and when a is again called we now see Hello World.

What we learn here is that JavaScript is executing code line by line, command is being executed one at a time, single threaded.

Invocation means calling a function or running a function.

In Javascript functions are invoked by using parenthesis, puting the name of the function and then following by parenthesis. That tells the Javascript engine to run it.

What are functions?.. Tune in to the next post

Back to Topics 👈🏻

Next Lesson: FunctionsClick here👉🏽

Take one minute to let us know what you want us to cover here Here .

Connect on twitter Twitter. share