当前位置:网站首页>严格模式,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)不允许函数参数重名
边栏推荐
- 业务测试如何避免漏测 ?
- Redis - message publish and subscribe
- PHP从txt文件中读取数据的方法
- Unknown CMake command “add_action_files“
- Angr(十二)——官方文档(Part3)
- A simple file transfer tools
- Mean Consistency Tracking of Time-Varying Reference Inputs for Multi-Agent Systems with Communication Delays
- 测试点等同于测试用例吗
- els block deformation
- CRS management and maintenance
猜你喜欢
随机推荐
[Solution] Emqx startup under win10 reports Unable to load emulator DLL, node.db_role = EMQX_NODE__DB_ROLE = core
Redis的集群模式
请教一下本网站左下角的动漫人物是怎么做的?
146. LRU cache
MLX90640 红外热成像仪测温传感器模块开发笔记(十) 成果展示-红眼睛相机
Collection of NFT tools
IO流基础
JSP built-in object out object function introduction
c语言字符和字符串函数总结(二)
Business test how to avoid missing?
JSP out.print()和out.write()方法的不同之处
Don't concatenate strings with jOOQ
Unknown CMake command “add_action_files“
C language character and string function summary (2)
DFS详解
JSP如何使用page指令让JSP文件支持中文编码呢?
Stapler:1 靶机渗透测试-Vulnhub(STAPLER: 1)
冒泡排序函数封装
JSP内置对象out对象的功能简介说明
青蛙跳台阶