是javascript编译还是只是解释?如果解释,提升功能如何可用。 [英] Is javascript compiled or just interpreted ? how is hoisting feature available if it is interpreted.

查看:66
本文介绍了是javascript编译还是只是解释?如果解释,提升功能如何可用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是编译JavaScript还是只是解释。



如果它只是一种解释语言,它不应该支持像提升这样的功能,因为仅支持提升功能如果执行引擎知道环境。



如果只是解释代码,环境信息将无法使用



什么我试过了:



寻找理论方面

Is JavaScript Compiled or just Interpreted.

In case it is just an Interpreted Language, it should not support feature like Hoisting, since feature of Hoisting is supported only if the execution Engine know about the Environment.

In case it just Interprets the Code, Environment Information would not be available

What I have tried:

Looking for the Theoretical aspect

推荐答案

Javascript是一种解释语言 - 它没有编译。

它总是使用提升,它不需要知道环境,它只需要在开始解释它之前读取源,并移动声明到包含范围的顶部,以便在声明它们之前使用它们。

JavaScript吊装 [ ^ ]

另外请参阅: JavaScript范围和提升 [ ^ ]对JS范围和提升有很好的解释。
Javascript is an interpreted language - it is not compiled.
It always uses hoisting, which does not need to know about the environment, it just needs to read the source before it begins interpreting it, and "moves" declarations to the top of the containing scope so they can be used before they are declared.
JavaScript Hoisting[^]
Also see: JavaScript Scoping and Hoisting[^] which has a good explanation of JS scope and hoisting.


Google Chrome中的V8编译器按照官方文档编译代码。



是在谈论javascript代码编译还是别的什么。






当引擎本身编译代码时,如何解释javascript。



请帮助我解决困惑。



问候,

Mayank Gupta
V8 compiler in Google Chrome Compile the Code as per it official Documentation.

Is it talking about javascript code compilation or something else.

Introduction · v8/v8 Wiki · GitHub

Please look for the General Introduction of V8 Engine.

When the Engine itself compiles the code, how can javascript be interpretted.

Please help me with the confusion.

Regards,
Mayank Gupta


这篇关于是javascript编译还是只是解释?如果解释,提升功能如何可用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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