Assignment to constant variable. 报错
时间: 2023-08-26 19:13:27 浏览: 131
报错提示
常量是使用const关键字定义的,一旦声明就不能修改其值。所以当我们尝试给常量赋值时,会报错"Assignment to constant variable"。这个错误是因为我们修改了一个常量的值,但常量是不可变的。这种错误在某些浏览器上可能不会报错,但是对常量的修改是无效的。所以在声明常量时,必须立即初始化它的值,不能在之后再赋值。<em>1</em><em>2</em>
#### 引用[.reference_title]
- *1* [vue3.2关于“TypeError: Assignment to constant variable”的问题解决方案](https://blog.csdn.net/qq_50883920/article/details/126653831)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [项目报错:Assignment to constant variable.](https://blog.csdn.net/Xiang_Gong_Ya_/article/details/128285095)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文