当前位置:网站首页>严格模式,use strict
严格模式,use strict
2022-08-02 00:14:00 【weixin_46051260】
使用严格模式,不会支持一些不规范的语法
1)调试更容易
2)变量在赋值之前必须要声明,防止意外的全局变量
function fun(){
a=10
}
fun()
console.log(a);//会造成内存泄漏
3)取消this的强制转换
var age=10
function fun(){
console.log(this.age);
}
fun.apply(null)
引用null或者未定义的值,this值会自动强制到全局变量,严格模式下会抛出错误,this不会指向全局变量
4)不允许函数参数重名
边栏推荐
- The Statement update Statement execution
- PHP to read data from TXT file
- 请教一下本网站左下角的动漫人物是怎么做的?
- Routing strategy
- [Headline] Written test questions - minimum stack
- An interesting project--Folder comparison tool (1)
- Microsoft PC Manager V2.1 beta version officially released
- An overview of the most useful DeFi tools
- Redis的集群模式
- Statement执行update语句
猜你喜欢
What is Low-Code?What scenarios is low code suitable for?
PHP to read data from TXT file
146. LRU cache
Collection of NFT tools
Pytorch seq2seq 模型架构实现英译法任务
鲲鹏编译调试插件实战
测试用例:四步测试设计法
Microsoft PC Manager V2.1 beta version officially released
uni-app project summary
Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?
随机推荐
An interesting project--Folder comparison tool (1)
06-SDRAM : SDRAM control module
Grid false data injection attacks detection based on coding strategy
Are test points the same as test cases?
PHP to read data from TXT file
使用jOOQ将Oracle风格的隐式连接自动转换为ANSI JOIN
What is it like to trade for a living?
Automatic conversion of Oracle-style implicit joins to ANSI JOINs using jOOQ
【CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!)(A~D)】
Web开发
nodeJs--mime module
460. LFU 缓存
Quick solution for infix to suffix and prefix expressions
Statement执行update语句
How to use the go language standard library fmt package
协作乐高 All In One:DAO工具大全
Realize deletion - a specified letter in a string, such as: the string "abcd", delete the "a" letter in it, the remaining "bcd", you can also pass multiple characters to be deleted, and pass "ab" can
JSP如何使用request获取当前访问者的真实IP呢?
Graphical LeetCode - 1161. Maximum Sum of In-Layer Elements (Difficulty: Moderate)
【HCIP】BGP小型实验(联邦,优化)