Sitemap
Bits and Pieces

Insightful articles, step-by-step tutorials, and the latest news on full-stack composable software development

Follow publication

JavaScript Internals: JavaScript engine, Run-time environment & setTimeout Web API

13 min readJun 19, 2019

--

Photo by Bram Naus on Unsplash

JavaScript Engine

Browser engines
JavaScript Engine
Execution Context Stack example
Output: Execution context stack example
GIF: Execution context stack at each stage of the above code execution

JavaScript Runtime Environment (JRE)

JavaScript Runtime Environment
console.log(window)
setTimeout and setInterval functions on the window object
setTimeout(callbackFunction, timeToDelay)
setTimeout basic syntax
setTimeout execution in zero milliseconds
clearTimeout to clean the timer

Example to understand all the above concepts

setTimeout example with waiting time 1000 ms
Output for setTimeout with waiting time 1000 ms
GIF: setTimout in the JavaScript Runtime environment. Heap not shown in JS engine.
setTimeout code for zero milliseconds waiting time
setTimeout with zero waiting time — output
conosle.log(window)
ai variable on windows object

--

--

Bits and Pieces
Bits and Pieces

Published in Bits and Pieces

Insightful articles, step-by-step tutorials, and the latest news on full-stack composable software development

Rupesh Mishra
Rupesh Mishra

Written by Rupesh Mishra

Backend Developer | Freelance Blogger