当前位置:网站首页>严格模式,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)不允许函数参数重名
边栏推荐
- [Solution] Emqx startup under win10 reports Unable to load emulator DLL, node.db_role = EMQX_NODE__DB_ROLE = core
- The Statement update Statement execution
- 基于超参数自动寻优的工控网络入侵检测
- JSP out. The write () method has what function?
- C语言实现扫雷游戏
- Statement执行update语句
- Redis的集群模式
- After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
- 基于编码策略的电网假数据注入攻击检测
- MySQL常用语句整理
猜你喜欢
随机推荐
Multidimensional Correlation Time Series Modeling Method Based on Screening Partial Least Squares Regression of Correlation Variables
Transient Stability Distributed Control of Power System with External Energy Storage
请教一下本网站左下角的动漫人物是怎么做的?
Play NFT summer: this collection of tools is worth collecting
06-SDRAM : SDRAM control module
uni-app project summary
JSP内置对象out对象的功能简介说明
An interesting project--Folder comparison tool (1)
When Netflix's NFTs Forget Web2 Business Security
Async/await principle and execution sequence analysis
MLX90640 红外热成像仪测温传感器模块开发笔记(十) 成果展示-红眼睛相机
Day11 shell脚本基础知识
ROS dynamic parameters
Redis - message publish and subscribe
What is the function of the JSP out.println() method?
Quick solution for infix to suffix and prefix expressions
What is the function of the JSP Taglib directive?
Don't concatenate strings with jOOQ
nodeJs--各种路径
go笔记——map









