Can Javascript be considered a interpreted language when using Google Chrome (V8)?

后端 未结 3 1226
-上瘾入骨i
-上瘾入骨i 2021-01-17 22:18

I was reading this excellent article on V8, Google\'s Javascript engine: https://developers.google.com/v8/design#mach_code.

At one point, they say that Javascript is

3条回答
  •  隐瞒了意图╮
    2021-01-17 22:58

    Here, let me demo the code:

      later(); // prove that js is a compiling language
      function later(num) {
        console.log("Your number is: " + num);
      }
    

    This piece of code could run both on Chrome Browser and Node js.

    If anyone says that js is an interpreted language, then this piece of code would crash, as when u run later(), it should not know the later function body.

    This could prove that js is a compiled language, as it compile later function (so machine could know it), then execute it.

提交回复
热议问题