Variable 变数
Node.js Variable 变数
Categories:
定义变数
什麽是 var, const, let
var 是 es6 出现之前定义变数的方法。
const 是常数一宣告就要指定值而且也不能被赋值 (不可再赋值也就是不能用 = 让他有新的位址),适合定义颜色这种不会变动的 ;
let 跟 var 相当像,最大不同就是 var 是 function scope 而 let、const 是 block scope ( function、if、for 都是 block scope)
constmeans that a variable’s value never changes, so const can’t be re-assigned the value ;
letis similar with var , they’re all variable declaration, but the biggest difference isvaris function scope butlet,constis block scope
