admin管理员组文章数量:1425707
What will be the output of the following code in ES5 piler? Will it throw any error or will it work fine?
let foo = 123;
let {x,y} = getValues();
What will be the output of the following code in ES5 piler? Will it throw any error or will it work fine?
let foo = 123;
let {x,y} = getValues();
Share
Improve this question
edited Aug 7, 2018 at 13:45
Saswata Arabinda
asked Aug 7, 2018 at 13:43
Saswata ArabindaSaswata Arabinda
5772 gold badges8 silver badges17 bronze badges
6
- 5 Have you checked it? – hsz Commented Aug 7, 2018 at 13:43
- While many implementations use jit (which still is not a static pile), javascript is in it's foundations an interpreted language, there is nothing like an "ES5 piler". – ASDFGerte Commented Aug 7, 2018 at 13:52
- 1 @ASDF ECMAScript is just a language. A particular implementation of it may be piled or interpreted. – deceze ♦ Commented Aug 7, 2018 at 14:23
- @deceze True. I was mainly concerned, that OP assumed the default action for javascript was pilation, but did wrong wording of "doesn't exist" vs "is absolutely not the standard action". Wikipedia has a good wording with "most of its implementations execute instructions directly and freely, without previously piling" – ASDFGerte Commented Aug 7, 2018 at 14:35
- @ASDF Even that is… debatable. Any code needs to be piled in some form or another. The CPU doesn't execute plain JS after all. The distinction is usually how much the piler does and how much time it spends doing it. Something like C goes through a whole many steps of processing and optimisation, while "interpreted" usually mostly means that a lot of the optimisation and static analysis steps are skipped. However, modern JS engines will do quite expensive optimisation sometimes in parallel on the fly. – deceze ♦ Commented Aug 7, 2018 at 14:38
2 Answers
Reset to default 7Will not work. let
was introduced in ES6.
It wouldn't work for an ES5 piler. But using Babel will solve this issue by transpiling your ES6 code down to patible versions.
本文标签: javascriptWill let keyword work on ES5Stack Overflow
版权声明:本文标题:javascript - Will let keyword work on ES5? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745408117a2657342.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论