What is the difference between JavaScript Engine and JavaScript Runtime Environment

后端 未结 4 2042
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 09:18

I\'m feeling a bit confused, could someone help to describe What is the difference between JavaScript Engine and JavaScript Runtime Environment. BTW, Event Loop was impleme

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 09:29

    Unlike C and other compiled languages, Javascript runs in a container - a program that reads your js codes and runs them. This program must do two things

    • parse your code and convert it to runnable commands
    • provide some objects to javascript so that it can interact with the outside world.

    The first part is called Engine and the second is Runtime.

    For example, the Chrome Browser and node.js use the same Engine - V8, but their Runtimes are different: in Chrome you have the window, DOM objects etc, while node gives you require, Buffers and processes.

提交回复
热议问题