3 best Ayurveda suggested remedies to treat acidity

Those constant hiccups, bad breath, bloating, burping, nausea, and chest burn could well, be a really annoying experience. Most of us, at some point in our lives, do suffer from acidity but for many…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




What happens when JavaScript executes my code ?

In order to explain how it works we need to take snippet of code :-

As soon as we start running our code, it creates a global execution context which leads to : -

Now a question arise in your mind is what the hack is “Execution context” and why we care about it ? So here is my understanding , Execution context is an abstract concept used by ECMAScript specification to track the runtime evolution of the code. Still confused ???now take an example of code snippet given above.

Whenever you execute a function in JavaScript, it creates a new execution context comprising execution thread and a local memory where anything defined in a function is stored.

Execution Context
Execution Context

2. It will call the function which is in the local scope and creates a local execution context

Call stack

Now after global execution stack is created it called the function and create one more stack as local execution context stack which firstly executes the local scope as given below in the fig.

After the execution of local scope it returns the value 16 and stored in res variable and return back to the function.

Call stack after execution of local scope

Now its time to execute global scope from call stack and after the execution we got function value as 16 and the global scope stack is also destroyed and hence the execution over.

Add a comment

Related posts:

Have An Innovative Solution for Healthcare Product Development? Get Involved in Our Crowdsourcing Challenges

When it comes to developing consumer healthcare products, some of the most creative solutions we’ve considered have come from the most unlikely of sources outside of GSK: the gaming industry…

Curso Marketing Digital

O Jovem que ganhava R$620 para R$55.440,57 Incrível não é, você conhecera um pouco da história de Tiago Gomes. Aos 20 anos ganhando R$ 55.440,57 por mês e hoje em dia com 21 anos, chega a obter…

Top Forklift Models Available To Purchase Locally For Your Denver Business

To take your Denver business to new heights you need equipment that can not only meet your current work requirements, but that can also accommodate your future demands. Patriot Forklifts is one of…