当前位置:网站首页>The const keyword of ES6 declares variables
The const keyword of ES6 declares variables
2022-07-29 03:45:00 【Haha, APE】
const The keyword is used to declare constants ,const The statement has the following characteristics
The declaration must be assigned an initial value
According to habit questions Identifiers are usually uppercase
Duplicate statements are not allowed
Value cannot be modified
Block level scope ( local variable )
Code block example :
The declaration must be assigned an initial value
// What statement must be given an initial value
const Sun;
// Running results :Uncaught SyntaxError: Missing initializer in const declaration
Duplicate statements are not allowed
const Animal = ' The rabbit '
const Animal = ' The rabbit '
// Running results :Uncaught SyntaxError: Identifier 'Animal' has already been declared
Value cannot be modified ( Modification of array elements and internal modification of objects are allowed ( Arrays and objects store reference addresses )
const Animal = " The rabbit "
Animal = " Little rabbit "
console.log(Animal);
// Report errors : TypeError: Assignment to constant variable
Block level scope
{
const Animal = " The rabbit "
console.log(Animal);
// Print the results : The rabbit
}
console.log(Animal);
// Report errors Uncaught ReferenceError: Animal is not defined
notes : Declare object types using const, Non object type declaration selection let
边栏推荐
- Connection broken by 'readtimc rt-443): read timed out (read timeout=l5)“)‘: /pac
- How to judge stun protocol
- What you see and think in Microsoft
- 向日葵远程控制为何采用BGP服务器?自动最优路线、跨运营商高速传输
- Android view system and custom view Series 1: (kotlin version)
- Shutter start white screen
- Shopify卖家:EDM营销就要搭配SaleSmartly,轻松搞定转化率
- 深入C语言(2)——结构的定义与使用
- EMD 经验模态分解
- EMD empirical mode decomposition
猜你喜欢

大厂们终于无法忍受“加一秒”了,微软谷歌Meta等公司提议废除闰秒

最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口

Solve the delay in opening the console of Google browser

The digitalization of the consumer industry is upgraded to "rigid demand", and weiit's new retail SaaS empowers enterprises!

Various minor problems of jupyter notebook, configuration environment, code completion, remote connection, etc

新零售O2O 电商模式解析

How to understand "page storage management scheme"

消费行业数字化升级成 “刚需”,weiit 新零售 SaaS 为企业赋能!

EMD 经验模态分解

The latest second edition of comic novels, listening to books, three in one, complete source code / integrated visa free interface / building tutorials / with acquisition interface
随机推荐
Malloc C language
RHCE的at,crontab的基本操作,chrony服务和对称加密和非对称加密
向日葵远程控制为何采用BGP服务器?自动最优路线、跨运营商高速传输
Multi level wavelet CNN for image restoration
Shopify seller: EDM marketing should be combined with salesmartly to easily get the conversion rate
sql
Use of leak scanning (vulnerability scanning) tool burpsuite or burp Suite (with installation and installation package download of burpsuite+1.7.26)
Excel拼接数据库语句
Why do many programmers hate pair programming?
Machine learning based on deepchem
代码 ~ 隐藏或禁用状态栏和虚拟按键
Rdkit: introduce smiles code, smart code and Morgan fingerprint (ECFP)
Various minor problems of jupyter notebook, configuration environment, code completion, remote connection, etc
Flutter 启动白屏
Kotlin companion object vs global function
The difference between int and integer. Is int or integer used in practical applications?
1. Mx6u driver development-2-led driver
Simple understanding of Poe and UPS Technology
Simple understanding of CDN, SDN and QoS
Excel splicing database statement