0
点赞
收藏
分享

微信扫一扫

JS 严格模式

九点韶留学 2022-04-14 阅读 173
前端
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
	
	<script type="text/javascript">
		// "use strict";
		
		// 严格模式:严格
		// 开启严格模式:"use strict"
		// 注意:必须放到作用域的开头

		
		// 变量必须申明
		// let n = 1;
		// console.log( n );

		// 普通函数中的this,不在指向window,而是undefined
		// function fn () {
		// 	console.log(this)
		// }
		// fn();

		// 函数形参不可以重名
		// function fn (a, a) {
		// 	// a = 1
		// 	// a = 2
		// 	console.log(a + a);
		// }

		// fn(1, 2);


	</script>



</body>
</html>
举报

相关推荐

0 条评论