+ 1
Ecmascript 6 let or var?
Why using let in example code instead of var to declare variables?It gives error in code playground try.
3 odpowiedzi
+ 4
I don't get an error. The reason for using let is that it behaves much more consistent compared to var. In general it's cleaner and also more efficient to use let. var is only needed seldom when using ES6.
Here's some further information:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
+ 2
Could you share the code? Otherwise it will be pretty hard to guess what caused the error...
+ 1
Only who learn javascript course can answer this one.But if you have an idea Aaron Eberhardt about ecs6 use of let and var in general for example:
let name = "Ahmad";
console.log(name);