- JavaScript:Moving to ES2015
- Ved Antani Simon Timms Narayan Prusty
- 284字
- 2021-07-09 19:07:31
Chapter 2. Functions, Closures, and Modules
In the previous chapter, we deliberately did not discuss certain aspects of JavaScript. These are some of the features of the language that give JavaScript its power and elegance. If you are an intermediate- or advanced-level JavaScript programmer, you may be actively using objects and functions. In many cases, however, developers stumble at these fundamental levels and develop a half-baked or sometimes wrong understanding of the core JavaScript constructs. There is generally a very poor understanding of the concept of closures in JavaScript, due to which many programmers cannot use the functional aspects of JavaScript very well. In JavaScript, there is a strong interconnection between objects, functions, and closures. Understanding the strong relationship between these three concepts can vastly improve our JavaScript programming ability, giving us a strong foundation for any type of application development.
Functions are fundamental to JavaScript. Understanding functions in JavaScript is the single most important weapon in your arsenal. The most important fact about functions is that in JavaScript, functions are first-class objects. They are treated like any other JavaScript object. Just like other JavaScript data types, they can be referenced by variables, declared with literals, and even passed as function parameters.
As with any other object in JavaScript, functions have the following capabilities:
- They can be created via literals
- They can be assigned to variables, array entries, and properties of other objects
- They can be passed as arguments to functions
- They can be returned as values from functions
- They can possess properties that can be dynamically created and assigned
We will talk about each of these unique abilities of a JavaScript function in this chapter and the rest of the module.
- SoapUI Cookbook
- 計算機圖形學編程(使用OpenGL和C++)(第2版)
- 樂學Web編程:網站制作不神秘
- Vue.js 3.0源碼解析(微課視頻版)
- Apache Karaf Cookbook
- 高級C/C++編譯技術(典藏版)
- PhoneGap Mobile Application Development Cookbook
- 網絡爬蟲原理與實踐:基于C#語言
- Hands-On Full Stack Development with Go
- 區塊鏈技術與應用
- Xamarin Blueprints
- Xamarin Cross-Platform Development Cookbook
- Mapping with ArcGIS Pro
- Distributed Computing with Python
- 區塊鏈:技術與場景