menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

How JavaSc...
source image

Dev

4d

read

246

img
dot

Image Credit: Dev

How JavaScript works underneath the hood?

  • JavaScript engine like V8 in chrome reads JavaScript codes that we write and convert them into machine executable instructions for the browser.
  • JavaScript has an engine known as the JavaScript engine, that each browser implements.
  • The engine has two parts, namely a memory heap and a call stack.
  • Memory allocation happens in the memory heap, while parsing (reading) and execution takes place in the call stack.
  • JavaScript is a single-threaded language that can be non-blocking.
  • Synchronous programming means that each line of code executes in order.
  • Asynchronous programming enables you to run code without waiting for an earlier line to finish executing.
  • SetTimeout is part of Web API and not part of JavaScript.
  • Web API, Callback queue, and Event loop form part of the JavaScript Runtime Environment that enables us to do asynchronous programming.
  • The call stack recognizes there is a setTimeout function that has been set, and it is not part of JavaScript but part of web API.

Read Full Article

like

14 Likes

For uninterrupted reading, download the app