JavaScript Engine和JavaScript Runtime Environment之间有什么区别 [英] What is the difference between JavaScript Engine and JavaScript Runtime Environment

查看:73
本文介绍了JavaScript Engine和JavaScript Runtime Environment之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感到有点困惑,有人可以帮忙描述JavaScript Engine和JavaScript Runtime Environment之间的区别。
BTW,事件循环是在引擎还是运行时实现的?

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 implemented in Engine or Runtime?

推荐答案

与C和其他编译语言不同,Javascript运行于容器 - 读取js代码并运行它们的程序。这个程序必须做两件事

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


  • 解析你的代码并将其转换为runnable命令

  • 提供一些javascript的对象,以便它可以与外部世界进行交互。

第一部分称为Engine,第二部分是Runtime。

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

例如,Chrome浏览器和node.js使用相同的引擎 - V8,但它们的运行时不同:在Chrome中你有窗口,DOM对象等,而节点给你 require ,缓冲区和进程。

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.

这篇关于JavaScript Engine和JavaScript Runtime Environment之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆