LEARNING JAVASCRIPT - Trang 153

(

function

() {

'use strict'

;

// all of your code goes here...it

// is executed in strict mode, but

// the strict mode won't contaminate

// any other scripts that are combined

// with this one

})();

Strict mode is generally considered a good thing, and I recommend you use it. If

you’re using a linter (and you should be), it will save you from many of the same

problems, but doubling up can’t hurt!
To learn more about what strict mode does, see the

MDN article on strict mode

.

Conclusion

Understanding scope is an important part of learning any programming language.

The introduction of

let

brings JavaScript in line with most other modern languages.

While JavaScript is not the first language to support closures, it is one of the first

popular (nonacademic) languages to do so. The JavaScript community has used clo‐

sures to great effect, and it’s an important part of modern JavaScript development.

Conclusion | 129

Liên Kết Chia Sẽ

** Đây là liên kết chia sẻ bới cộng đồng người dùng, chúng tôi không chịu trách nhiệm gì về nội dung của các thông tin này. Nếu có liên kết nào không phù hợp xin hãy báo cho admin.