当前位置:网站首页>TypeScript:const
TypeScript:const
2022-07-01 14:47:00 【Everything has changed every day】
Use const Defined variables and uses let Defined variables have the same scope , The difference lies in the use const The defined variable cannot be re assigned later :
const a = 1;
a = 2;//error TS2588: Cannot assign to 'a' because it is a constant.But if const Definition is object Or variables of array type , Variables themselves cannot be reassigned , But the object or array represented by the variable can still be modified :
const a = {
data : 1
};
a.data = 2;
console.log(a);// Output { data: 2 }
a = {data : 1};//error TS2588: Cannot assign to 'a' because it is a constant.
const b = [1,2];
b.push(3);
console.log(b);// Output [ 1, 2, 3 ]
b = [4,5,6];//error TS2588: Cannot assign to 'b' because it is a constant.边栏推荐
- DirectX修复工具V4.1公测![通俗易懂]
- 博文推荐 | 深入研究 Pulsar 中的消息分块
- [zero basic IOT pwn] reproduce Netgear wnap320 rce
- Advanced C language
- Research Report on the development trend and competitive strategy of the global powder filling machine industry
- 数据产品经理需要掌握哪些数据能力?
- Mongodb second talk - - mongodb High available Cluster Implementation
- Research Report on the development trend and competitive strategy of the global diamond suspension industry
- 从零开发小程序和公众号【第三期】
- What are the books that have greatly improved the thinking and ability of programming?
猜你喜欢

2022-2-15 learning the imitation Niuke project - post in Section 2

Minimum spanning tree and bipartite graph in graph theory (acwing template)

对于编程思想和能力有重大提升的书有哪些?

Basis of target detection (NMS)

sqlilabs less-8
![[14. Interval sum (discretization)]](/img/e5/8b29aca7068a6385e8ce90c2742c37.png)
[14. Interval sum (discretization)]

Build your own website (14)
![[15. Interval consolidation]](/img/6c/afc46a0e0d14127d2c234ed9a9d03b.png)
[15. Interval consolidation]
![[dynamic programming] interval dp:p1005 matrix retrieval](/img/c9/2091f51b905d2c0ebc978dab3d34d3.jpg)
[dynamic programming] interval dp:p1005 matrix retrieval

phpcms实现订单直接支付宝支付功能
随机推荐
Rearrangement of overloaded operators
这3款在线PS工具,得试试
C 语言进阶
使用net core 6 c# 的 NPOI 包,讀取excel..xlsx單元格內的圖片,並存儲到指定服務器
sqlilabs less10
[Verilog quick start of Niuke question series] ~ use functions to realize data size conversion
2022-2-15 learning xiangniuke project - Section 1 filtering sensitive words
Mongodb second talk - - mongodb High available Cluster Implementation
Some thoughts on software testing
It's suitable for people who don't have eloquence. The benefits of joining the China Video partner program are really delicious. One video gets 3 benefits
Provincial election + noi Part 10 probability statistics and polynomials
sqlilabs less-8
JVM第一话 -- JVM入门详解以及运行时数据区分析
Research Report on the development trend and competitive strategy of the global facial wrinkle removal and beauty instrument industry
DirectX修复工具V4.1公测![通俗易懂]
Research Report on the development trend and competitive strategy of the global electromagnetic flowmeter industry
官宣:Apache Doris 顺利毕业,成为 ASF 顶级项目!
tensorflow2-savedmodel convert to tflite
Sorting learning sorting
Day-02 database