- 801
- 1
- 11
- 28
If you're writing server-side JavaScript code (Node.js), you can safely use the
letstatement.If you're writing client-side JavaScript code and use a browser based transpiler (like Traceur or babel-standalone), you can safely use the
letstatement, however your code is likely to be anything but optimal with respect to performance.If you're writing client-side JavaScript code and use a Node based transpiler (like the traceur shell script or Babel), you can safely use the
letstatement. And, because your browser will only know about the transpiled code, performance drawbacks should be limited.If you're writing client-side JavaScript code and don't use a transpiler, you need to consider browser support.
There are still some browsers that don't support
letat all :
(*) Globally and functionally scoped variables can be initialized and used before they are declared because JavaScript variables are hoisted. This means that declarations are always muchmoved to the top of the scope.
If you're writing server-side JavaScript code (Node.js), you can safely use the
letstatement.If you're writing client-side JavaScript code and use a browser based transpiler (like Traceur or babel-standalone), you can safely use the
letstatement, however your code is likely to be anything but optimal with respect to performance.If you're writing client-side JavaScript code and use a Node based transpiler (like the traceur shell script or Babel), you can safely use the
letstatement. And because your browser will only know about the transpiled code, performance drawbacks should be limited.If you're writing client-side JavaScript code and don't use a transpiler, you need to consider browser support.
There are still some browsers that don't support
letat all :
(*) Globally and functionally scoped variables can be initialized and used before they are declared because JavaScript variables are hoisted. This means that declarations are always much to the top of the scope.
If you're writing server-side JavaScript code (Node.js), you can safely use the
letstatement.If you're writing client-side JavaScript code and use a browser based transpiler (like Traceur or babel-standalone), you can safely use the
letstatement, however your code is likely to be anything but optimal with respect to performance.If you're writing client-side JavaScript code and use a Node based transpiler (like the traceur shell script or Babel), you can safely use the
letstatement. And, because your browser will only know about the transpiled code, performance drawbacks should be limited.If you're writing client-side JavaScript code and don't use a transpiler, you need to consider browser support.
There are still some browsers that don't support
letat all :
(*) Globally and functionally scoped variables can be initialized and used before they are declared because JavaScript variables are hoisted. This means that declarations are always moved to the top of the scope.
- 31.3k
- 22
- 110
- 134