Function declaration Function assignment expression Assignment expression of named function Functions are first-class objects in JavaScript, which means that functions can be passed like other values. A common usage is to pass an anonymous function as a callback function into an asynchronous function. The method above the function declaration function foo() {} will be parsed (hoisted) before execution, so it exists anywhere in the current context, even if it is called above the function definition body. foo(); // Runs normally because foo has been created before the code runs function foo() {Function assignment expression var foo = function() {}; This example assigns an anonymous function to variable foo. foo; // 'undefined' foo(); // Error
1. JavaScript Advanced Series - Function Declaration and Expression
Introduction: Functions are first-class objects in JavaScript, which means they can be passed around like other values. A common usage is to pass an anonymous function as a callback function into an asynchronous function.
2. JavaScript Advanced Series—Equality and Comparison in Types
Introduction: The equal operator consists of two equal signs: == JavaScript is a weakly typed language, which means that the equal operator will perform a cast in order to compare two values.
3. JavaScript Advanced Series—How this works
##Introduction: JavaScript has a completely different mechanism for processing this than other languages. In five different cases, this points to something different.
4. JavaScript Advanced Series - Closures and References
##Introduction: Closure is a very important feature of JavaScript, which means that the current scope can always access variables in the outer scope. Because functions are the only structures in JavaScript that have their own scope, the creation of closures relies on functions.
5.
JavaScript Advanced Series—arguments Object
Introduction: Every function in JavaScript can access a special variable arguments. This variable maintains the list of all parameters passed to this function.
6.
JavaScript Advanced Series—Why not use eval
##Introduction: The eval function executes a JavaScript code string in the current scope.
7.
JavaScript Advanced Series—Scope and Namespace##Introduction: Although JavaScript supports code segments created by a pair of curly braces, it does not support block-level scope; it only supports function scope.
8. JavaScript Advanced Series - for in loop
##Introduction: Like the in operator, the for in loop also traverses all properties on the prototype chain when looking for object properties.
9. JavaScript Advanced Series—Object Usage and Properties
##Introduction: A common misunderstanding is that numerical literals cannot be used as objects. This is due to a bug in the JavaScript parser, which attempts to parse dot operators as part of a floating-point literal value.
10. JavaScript Advanced Series—Prototype
##Introduction: Often mentioned as a shortcoming of JavaScript, the prototype-based inheritance model is actually more powerful than traditional class inheritance. Implementing the traditional class inheritance model is easy, but implementing prototypal inheritance in JavaScript is much more difficult. (It is for example fairly trivial to build a classic model on top of it, while the other way around is a far more difficult task.)
The above is the detailed content of Summary of related courses for the advanced series. For more information, please follow other related articles on the PHP Chinese website!