ECMA Concept
-> 'let ' is an scope varible it can't be use as globle varible
-> if we'r using 'var' in place of let it will re-assign last defined value (means
var a = 30
var a = 30
console.log("value of a is:"+a)
OUTPUT-
value of a is = 30
)
if we are using 'let' inplace of var then it look like
let a=40;
let a=30;
OUTPUT
SyntaxError: Identifier 'a' has already been declared
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
let a=30;
output-
value of a under function :40
value of a:30
No comments:
Post a Comment