当前位置:网站首页>Typescript -- Section 2: variable declaration
Typescript -- Section 2: variable declaration
2022-06-28 23:47:00 【Run Coder】
Variable declarations

Variable declarations described in this section (var let const) Is based on JavaScript Of , The method used is exactly the same .
Simply familiarize yourself with the usage
- var( Not recommended )
· Used to declare the global scope and Local scope ( Or function scope ), Block level scopes cannot be declared
· There is variable promotion
· have access to var Declare duplicate variable names , The front will be covered by the back . - let( It is recommended to use )
· Used to declare a block level scope . for example {}, Is a scope
· No variable promotion
· Repeated declaration of variables in the same scope , Will report a mistake
· Temporary dead zone (TDZ). It means that the variable already exists in the scope , Must be in let / const Use... After the declaration ;TDZ It enables developers to form the habit of declaration before use , Make the program more stable - const( It is recommended to use )
·const Declare a read-only constant , Once declared , Constant values cannot be changed . therefore const Once declared, it must be initialized immediately .
· Except for the first one , Others are similar to let
· Little knowledge supplement : Generally, variable names used to declare constants use upper case letters , Convention becomes custom , Just like the constructor's name is capitalized .
- Do simple things over and over again , Do it seriously !!! --wcc
边栏推荐
- How to solve the database type error in the operation of the servert project?
- IO playback function of FIO
- 华为22级专家十年心血终成云原生服务网格进阶实战文档,是真的6
- TypeScript -- 第一节:基础类型
- Have you ever met a fake interview in a job interview? How to avoid?
- [stm32 Hal library] RTC and BKP drives
- 图片64base转码与解码
- stm32F407-------串行(串口)通信
- What are the virtual machine software? What are their respective roles?
- stm32F407-------LCD
猜你喜欢

What are the virtual machine software? What are their respective roles?

Stm32f407----- capacitive touch button

从SQL注入绕过最新安全狗WAF中学习fuzz

Use conditional breakpoints in vscode (based on GDB)

stm32F407-------电容触摸按键

stm32F407-------LCD

stm32F407-------串行(串口)通信

Quartz explanation and use

Stm32f407 ------ clock system (systeminit clock initialization, systick tick timer)

Machine learning 6-decision tree
随机推荐
Chapter IV memory management exercise
Is it difficult to register stocks and open accounts online? Is it safe to open an account online?
Yyds dry goods inventory building knowledge map from scratch with neo4j (I)
Be on the list again! Know that Chuangyu was selected as one of the top 50 competitive enterprises in China's network security industry in 2022
stm32F407-------跑马灯、蜂鸣器
Lock4j -- distributed locking Middleware -- use / instance
在线买股票开户安全嘛?
百度知道爬虫,根据问题id,线索id,评论id获取评论下面的对话
TypeScript -- 第二节:变量声明
Learning fuzzy from SQL injection to bypass the latest safe dog WAF
When dialogfragment's onstop is completely invisible, call disass to exit the interface and report an error. Solution
Form verification problem - El select (solution to automatically trigger verification on initialization page)
Stm32f407 ------ running lamp and buzzer
三個pwn題
Huawei's level 22 experts have worked hard for ten years to complete the advanced practical document of cloud native service grid. 6
Stm32f407 ------- GPIO input experiment
入行数字IC验证后会做些什么?
The secondary market is full of bad news. How should the market go next? One article will show you the general trend
mysql-5.7.30-winx64免安装版下载安装教程
表单校验问题——el-select(初始化页面自动触发校验解决办法)