Objects (object):
All things in JavaScript are objects, such as strings, numbers, arrays, functions, and so on, each with properties and methods. JavaScript provides multiple built-in objects, such as String, Date, Array, and so on.
Properties of the object:
Reflecting some specific properties of the object, such as: the length of the string, the long width of the image, etc.;
Method of the object:
An action that can be performed on an object. For example, the form "submit" (submit), the time of "get" (getYear), etc.;
Object definition:
Before using an object, define it first, using the array object as follows:
1 var objectname=new Array ();//define an object with the New keyword
Or:
1 var objectname=[];
To access the properties of an object:
Objectname.propertyname
Instance:
var myarray=new array (6);//defines an array object of length 6
var myl=myarray.length;//defines a value and gives the length amplitude of the array myarray to Myl
methods for accessing objects:
Objectname.methodname ()
Instance:
var mystr= "Hello world!" Create a string var request=mystr.touppercase ();/* Defines a string and will use the toUpperCase method of the String object
The resulting value is assigned to it, and the value of the request is: HELLO world!*/
/*touppercase method: Convert Text to uppercase */
Code Volume: 9 Lines
Date: 2016.5.25
Learning Path: MU class network
Zeng Su
For reprint or use please contact email ([email protected])
JavaScript Learning-javascript built-in Object 1-Overview of objects