How JavaScript Works? What happens when you run JavaScript program?

When you run a JavaScript program, the JavaScript Engine creates a Global Execution Context (GEC). Every piece of JavaScript code executes…