JS6 (built-in object)

Source: Internet
Author: User

All things in JavaScript are objects, such as strings, numbers, arrays, functions, and so on, each with properties and methods .

Object properties: reflect the object of certain specific properties, such as: the length of the string, the image of the long width, etc.;

object: an action that can be performed on an object. For example, the form "submit" (submit), the time of "get" (getYear), etc.;

JavaScript provides a number of built-in objects, such as String, Date, array, and so on, defined before using the object, using the array object as follows:

var objectName =new Array ();//Use the New keyword to define an object

or var objectName =[];

Syntax for accessing object properties:

Object name. property name;

Methods for accessing objects:

The name of the object. Method Name ();

Date Day Object

Date objects can store any date and can be accurate to milliseconds (1/1000 seconds).

Define a Time object:

var udate=new Date ();

Note : Use the first letter of the keyword New,date () to capitalize.

If you want to customize the initial values, you can use the following methods:

var d = new Date (2012, 10, 1); October 1, 2012
var d = new Date (' OCT 1, 2012 '); October 1, 2012

We'd better use the "method" described below to strictly define the time.

access method Syntax:"< date objects >.< methods >"

Common methods for processing time and dates in a Date object:

See the API for details

String String Object

Use the toUpperCase () method of the string object to convert the string lowercase letters to uppercase:

Returns the character at the specified position

The CharAt () method returns the character at the specified position. The returned character is a string of length 1.

Syntax:stringobject.charat (Index)

JS6 (built-in object)

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.