FrontendDeveloper.in

JavaScript question detail

Does the `const` variable make the value immutable

No, the const variable doesn't make the value immutable. But it disallows subsequent assignments(i.e, You can declare with assignment but can't assign another value later)

const userList = [];
userList.push("John"); // Can mutate even though it can't re-assign
console.log(userList); // ['John']
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399