Get the App
SLTechnology News&Howtos  ›  Development  › 

Const declares which types of variables in JavaScript can be changed

Shulou Source: shulou.com Published: 2022-06-01 05:04:11 10月03日 Update

This article is about which types of const declaration variables in JavaScript can be changed. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Const declares which types of variables can be changed

If the value does not want to be changed, you can use const:

Const name = 'front-end intelligence'; name = 'Wang Daye'; / / error report const list = []; list = [1]; / / error report const obj = {}; obj = {name: 'front-end intelligence'}; / / error report

A reference type that can be declared with const, where the value can be changed:

Const list = []; list.push (1); / can work list [0] = 2; / can work const obj = {}; obj ['name'] =' front-end intelligence'; / / can work thank you for reading! This is the end of this article on "which types of const declaration variables in JavaScript can be changed". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Type variable front-end intelligence work content more article good practical article see knowledge Wang Da reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB Linux vpn Docker