当前位置:网站首页>严格模式,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)不允许函数参数重名
边栏推荐
猜你喜欢

146. LRU 缓存
![[Headline] Written test questions - minimum stack](/img/67/08f2be8afc780e3848371a1b5e04db.png)
[Headline] Written test questions - minimum stack

Trie详解

Knowing the inorder traversal of the array and the preorder traversal of the array, return the postorder history array

Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?

Unknown CMake command “add_action_files“

Redis的集群模式

字符串分割函数strtok练习

Task execution control in Ansible

go笔记——锁
随机推荐
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
鲲鹏编译调试插件实战
MySQL常用语句整理
nodeJs--mime module
PHP to read data from TXT file
An Enhanced Model for Attack Detection of Industrial Cyber-Physical Systems
uni-app project summary
Redis-消息发布订阅
JSP如何使用page指令让JSP文件支持中文编码呢?
JSP how to obtain the path information in the request object?
[Solution] Emqx startup under win10 reports Unable to load emulator DLL, node.db_role = EMQX_NODE__DB_ROLE = core
Detailed explanation of JSP request object function
[21-Day Learning Challenge] A small summary of sequential search and binary search
面试:简单介绍你参与的一个项目
【21天学习挑战赛】顺序查找和二分查找的小总结
IO stream basics
MYSQL(基本篇)——一篇文章带你走进MYSQL的奇妙世界
Are test points the same as test cases?
IO流基础
基于超参数自动寻优的工控网络入侵检测