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
