It is neither software nor hardware, it is a program written in a low-level language. Some of the popular JS engines are -
V8 from Google.
SpiderMonkey is developed by Mozilla for use in Firefox and its forks.
Chakra is the engine of the Internet Explorer browser. It was also forked by Microsoft for the original Edge browser, but Edge was later rebuilt as a Chromium-based browser and thus now uses V8.
Is JS an interpreted or compiled language?
All the phases of code from parsing to compilation and then to execution is carried out in the JS engine.
- Execution and compilation go hand in hand. Interpreter makes a bytecode.
- New optimized version of code is created by the compiler before the execution. It is in sync with the interpreter while the code is interpreted line by line, the compiler tries to optimize the code as much as it can on the runtime (that's why called JIT compilation). It can happen in multiple phases. All JS engines have their own algorithms for doing it.
- The execution of bytecode is not possible without the memory heap and call stack of the JS engine.
- JS uses call stack to manage execution contexts.
- Memory heap is where all the memory is stored and is constantly in sync with a call stack, garbage collector, etc. This garbage collector continuously checks for unused variables and functions and marks them as garbage and sweeps it. This is done using different algorithms.
Every browser wants to make its JS engine the best among others, but so far at this present time, Google's V8 engine is considered the fastest engine ever created.
For more information, you can refer here.
Did you find this article valuable?
Support Aakanksha Bhende by becoming a sponsor. Any amount is appreciated!