All objects
The value type in JS is not the object that remains the object (that is, the reference type)
The typeof () operator determines four types of values
typeof 10; --Number | | typeof "Ten"-->string | | typeof true--Boolean | | typeof X--undefined
typeof (Funciton () {})--function
typeof ([+])--Object
typeof ({a:1,b:2})---Object
typeof (Null)--Object
typeof (new number)--Object//
Judging a variable is not an object very simple value type use typeof () to judge the reference type with instanceof ()
Note: The rule of instanceof () operator : A instanceof B is the prototype property of a constructor pointing to an object that has another prototype chain to detect the object on?
A is the object B is generally a constructor, along the __proto__ of a (invisible prototype) up the first look up, while along the prototype line B to find, if both can find the same reference, return True
collection of several properties of the object
In JavaScript, an array is an object, a function is an object, an object is an object, and a property is represented as a key-value pair, so the difference between a property method and a later key value is different.
var obj = {
A:10,
B:function () {},
C: {
Name: "Liuxiankun",
year:1992
},
};
Obj is a custom object with a B C three properties, the value of the C property is an object, and there are two properties
Functions and arrays are also objects that cannot be defined with the above method (because the above custom object is an instance of new object), but as long as the object is a collection of properties
function as an example
var fn = function () {}
Fn.a = 10;
fn.b = Funciton () {}
FN.C = {
Name: "Liuxiankun",
year:1992
}
The function in the above code is assigned a value of three properties. A collection of properties that are obviously
$.trim in jquery ()
$ is a function in itself
$.trim () is the value of a property property on a function.
JS Prototype Object Chapter