Home  >  Article  >  Web Front-end  >  js underlying basic analysis

js underlying basic analysis

php中世界最好的语言
php中世界最好的语言Original
2018-06-04 17:28:101853browse
<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.

The concept, function, creation and calling of Js functions!

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)

Filter use case summary

The above is the detailed content of js underlying basic analysis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn