I wrote random code in the Chrome console. To my surprise, chrome let me use letas a variable name, which is completely wrong, as it letis a reserved keyword. I need to understand why this is happening.
let
Scenarios:
var const = 78 //throws an error as expected var function = 46 //throws an error as expected var let = 56 //didn't throw an error :O let //prints 56, which is wrong because 'let' is a keyword let ab = 90 ab //prints 90 as expected
This flaw exists in node. But, when I try it in Babel REPL , it throws an error.
node
I think this is related to Google v8
. .
JavaScript FutureReservedWord:
FutureReservedWord
implements interface let package private protected public static yield
; :
SyntaxError: Cannot use the reserved word 'let' as a variable name in strict mode.
, pre-ES2015 - - let , , , , JS .
ES6 .
( ) . Node , "use strict"; .
"use strict";
Chrome, :
"use strict"; var let = 43; // Throws: Uncaught SyntaxError: Unexpected strict mode reserved word
Source: https://habr.com/ru/post/1660664/More articles:Foldable box in Shiny app - cssUse interface as published property linkage - propertiesHow is the interrupt vector SCI - system management? - x86R: dplyr - error when using the transcode function - rCan I add an HTTP header from AWS Custom Auth on an API gateway? - amazon-web-servicesDocker-compose cannot run jar file, but works with Dockerfile - dockerTitan Db ignores index - gremlinAndroid - name - androidИндекс TitanDB не изменяется - gremlinHow to get RecordID from CNContactStore ios - iosAll Articles