今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
JavaScript strict mode
- [Instructor] Let's delve into JavaScript strict mode. This feature allows you to place your entire script or individual functions in a strict operating context. Let's find out what that means. Strict mode is a way to catch common coding issues and enforce stricter parsing and error handling in your JavaScript. By opting into strict mode, you can avoid silent errors and ensure you coded the errors to best practices. Using strict mode helps in multiple ways. It catches common coding mistakes and unsafe actions, such as assigning to undeclared variables. It prevents the use of keywords reserved for future JavaScript versions, and stop you from doing things that are generally considered bad practices. To enable strict mode, simply add use strict. So for example, in this function here, what will you need to do is add use strict like so. And then all these errors here would essentially be bad and would actually be notified. So if you create an unintendedGlobal, you would actually get an…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。