Home > Web Front-end > JS Tutorial > JS programming common sense is very useful_javascript skills

JS programming common sense is very useful_javascript skills

WBOY
Release: 2016-05-16 17:47:51
Original
1111 people have browsed it
1. Right and wrong in JS
JS is a computer programming language, a dynamic language also called a scripting language, and an analytical programming language. Why script? Because it cannot be executed by itself, that is, there is no main function or entrance to the main program, and it must be parsed and executed by its host environment, that is, the parsing environment. Why is analytic type? Because JS does not perform programming, linking, assembly and other systematic processes to generate a file and then execute it, it will be loaded and executed in the form of a string.
2. True and false in JS
Empty, null, undefined, false, 0, "", '', NaN are all false, others are true
3. What is the difference between functions, classes, objects, and constructors?
Answer: In js, there is no difference between functions, classes, objects, and constructors. We can say that functions are objects, objects are classes, and classes are constructors. But generally, we call objects instances of that class to reduce confusion.
Copy code The code is as follows:

function Person(){
}
var person = new Person();
//Person can be called a function, class, object, constructor (without parameters)
//person is called a reference to an object

4. Understand the this keyword, and you understand one-fifth of JS.
This always points to the object that calls the method (function). (Must memorize)
First of all, you must know that this is What?
This is an object in js. It is an object, not a function. You can regard this object as a reference to an object. Who is the reference to? Reference to the object that called the method.
Where does this object exist? Exists in JS code, usually in functions. If you put this in a
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template