Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

chrome和Firefox对let的实现不一样吗?

image.png

图左是chrome,图右是firefox.
chrome中不会报错,而firefox则会报重复声明的错误.

仅仅是觉得有点奇怪,这种差异是什么原因造成的?
在其他JS引擎中也会有这种情况?(比如)
重复使用let并不一定会"重复声明"的报错?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

这个是 Chrome 康嫂的 feature 啦,以前也报错,后来为了开发者方便才引入的这个 feature 。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...