Home > Article > Web Front-end > js underlying basic analysis
<span style="font-size: 14px;">脚本语言JavaScript引擎脚本语言</span>
was first designed and implemented on the NetscapeNavigation browser in 1995 by Brendan Eich of Netscape. . Because Netscape was working with Sun, Netscape management wanted it to look like Java, hence the name JavaScript. But in fact its grammatical style is closer to Self and Scheme.
There are 3 ways to create a function, and there is not a single way to call it. There are 4 ways to call it!
1. Call function name() as a function; (Call the function as a global object, which will make the value of this become a global object, use window objectAs a variable, it is easy to cause the program to crash!)
2. Calling a function as a method: (Calling a function as a method of an object will cause The value of this becomes the object itself!)
3. Use constructor to call the function: (constructor This in has no value)
4. Call the function as a function method: (This can set the value of this, and I can return different this!)
Function in js It is an object. It is an object. It has attributes and methods, and call() and apply() are predefined function methods!
These two methods can call functions. The first parameter of both methods must be the object itself!
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Summary of inheritance methods in JS (with case)
The above is the detailed content of js underlying basic analysis. For more information, please follow other related articles on the PHP Chinese website!