First, let's look at what the objects are.
Null,array,function,object,prototype,regexp,date, these are objects, where null is special, and where it's special, we'll talk about it next.
So how do you create an object? So~yi~z
//How to create an arrayMethod 1:vararr =[]; Method 2:vararr =NewArray ();//How to create a functionMethod 1:varfn =function() {} Method 2:varfn =Newfunction (); functions are created in a variety of ways, not listed here//How to create an objectMethod 1:varOBJ ={}; Method 2:varOBJ =NewObject ();//the creation of regular objectsMethod 1:varReg =//;Method 2:varReg =NewRegExp ();
Creation of Time objects
Method 1:var date = new Date ();
So what's the difference between an object and a normal type?
An object can customize properties and methods.
var str = "111" ;str.index = 520;console.log (Str.index); // undefined // var arr = [];arr.index = 520;console.log (Arr.index); // 520 Arr.fn = function "Chasing the Dream sub-blog" // chasing Dream blog
The variable under the object is called the object's property, the function below the object, the method called the object, and the other object has many built-in methods, and properties, which we'll cover in a later section.
What are built-in objects and what are built-in methods?
In short, the built-in object and built-in method is to say that this object or method is JS in advance to provide you with, you can directly use, for custom means JS allows us to create some objects and methods. These are the built-in objects, like the following.
var New Array (); var New Function (); var New Object (), etc. ...
Here's a brief introduction.
Simple to understand what an object is