`let` over `var`?
See original GitHub issueI notice in the examples const
is used but in the source var
is all over the place. I suppose this is one of those why-fix-it-if-it-works things, but I have to ask what was the thinking behind using the more problematic, functionally scoped var
over let
?
Truth be told I am convinced (and helping to convince my students) of the dangers of var
in general and that its time has past. Am I missing a solid reason not to say this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Advantages of using let over var within a function [duplicate]
Advantages of using let over var within a function [duplicate] · As per this answer they are identical within a function like yours....
Read more >Var, Let, and Const – What's the Difference? - freeCodeCamp
var variables can be updated and re-declared within its scope; let variables can be updated but not re-declared; const variables can neither be ......
Read more >let - JavaScript - MDN Web Docs
let allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used,...
Read more >Difference between var and let in JavaScript - GeeksforGeeks
Variable declared by let cannot be redeclared and must be declared before use whereas variables declared with var keyword are hoisted.
Read more >JavaScript: Var, Let, or Const? Which One Should you Use?
Use let when you know that the value of a variable will change. Use const for every other variable. Do not use var....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Makes sense. I was confused by the use of
const
(a JavaScript 2015 thing along withlet
) in the example code in the main readme. That implied an assumption of at least that version required in the framework.[I have been looking for a framework written in ES6 to use because I have no desire to promote further use of any previous standard despite backward compatibility issues. I realize that is not for everyone. I was kinda hoping as new as hyperapp is that it might be one brave enough to throw off the old—especially after reading the ‘drop JSX’ thread. 😁 ]
To follow backward compatibility ES6 come with most of the ES5 feature. So writing ES5 is actually writing ES6.
I mean by that you can still use
var
and claim you are using ES6 aslet
,const
andvar
are part of the specification. They are all three a different meaning.