JS in BrowserBOM and DOMBrowser EventsWeb APIAjaxJQueryMost popular libraries
Advancedprototypes Object Oriented ProgrammingModulesAsynchronous programmingBinary DataInternationalizationreactangularjsProjects
MiscellaneoustypescriptJS ecosystemChrome dev toolstesting frameworksInterview questions and Answers
- 1995 - First released
- 2009 - ES5 released
- 2015 - ES6 released
- 2016 - ES7 released
- 2017 - ES8 released
- 2018 - ES9 released
- 2019 - ES10 released
- Chrome - V8 - fastest JS engine - born in 2008
- IE/Edge - Chakra was being used in the beginning but In 2020, edge started using Blink and V8 engines
- Firefox - Spidermonkey
- opera - carakan
- JDK - Nashom JS runtime
- NodeJS/Deno - It uses V8 JS runtime
- Parser will parse the JS source code
- AST - Abstract Syntax Tree is created
- Ignition Interpreter will interpret the AST and create a byte code
- Turbofan compiler will compile the bytecode and create optimized machine code which is then executed by CPU.
JS runtime architectureJS runtime environment consists of 3 parts - engine, web API, event loop polling message queue.
- Web api include dom manipulation, XMLHttpRequest, setTimeout, setInterval etc. Whenever JS engine encounters these web apis, task is delegated to separate threads. When the event is triggered, callbacks are pushed to macro queue (e.g. setTimeout, onClick event) or microtask queue (e.g. fetch promise).
- Event loop is constantly polling message queue(callback queue) and microtask queue and as soon as JS engine is free, it will ask JS engine to execute these tasks in FIFO order. MicroTask Queue has higher priority than Macro Task Queue.
Web development and Automation testing