JavaScript Learning-javascript Built-in Object 1-Overview of objects

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.