have block scope like let keyword
// ES5 var value = "hey"; value = "Cool"; console.log(value); // Cool // ES6 const value = "hey"; value = "Cool"; console.log(value); // Error: "value" is read-only
const obj = {}; obj.name = "Hemant"; console.log(obj); // {name: "Hemant"} // but const obj = {}; obj = {location: "HYD"}; console.log(obj); // Error: "obj" is read-only
const API_KEY = "XXX"; const API_SECRET = "DDGD_DDDGG-SS"; const port = 4000; const PI =3.14;
Last updated 4 years ago
Was this helpful?