Excerpt from: http://www.cnblogs.com/ksl666/p/5944718.html
Variables defined by 1.const cannot be modified and must be initialized.
2.var defined variables can be modified, if not initialized will output undefined, will not error.
1 var a = 1;2//var a;//will not error 3 Console.log (' Out of function var definition a: ' + a ');//Can output a=14 function change () {5 A = 4;6 Console.log (' var within function ' definition a : ' + a);//Can output a=47} 8 Change (), 9 console.log (' function call after Var definition A is the function of the internal modified value: ' + a);//Can output a=4
3.let is a block-level scope, and after the function is defined with let, there is no effect on the outside of the function.
1 Let C = 3;2 console.log (' Out of function let ' definition C: ' + C ');//Output c=33 function change () {4 let c = 6;5 console.log (' in function let definition C: ' + C);//Output c=6 6} 7 change (); 8 Console.log (' A let definition after a function call is not affected by the internal definition of the function: ' + C ');//Output c=3
Const,var,let Differences in JS