JavaScript Core Reference

Source: Internet
Author: User
Tags gmt time zone deprecated local time natural logarithm square root

Array

Method

Concat ()

The elements are linked into the array.

Every ()

Tests whether the assertion function is true for each array element.

Filter ()

Returns an array element that satisfies the assertion function.

ForEach ()

Invokes the specified function for each element of an array.

IndexOf ()

Finds the matching element in the array.

Join ()

Converts all elements of an array into strings and joins together.

LastIndexOf ()

Reverses the lookup in the array.

Map ()

Computes a new array element from the elements of the array.

Pop ()

Removes the last element of the divisor group.

Push ()

Adds an element to the tail of the array.

Reduce ()

From the elements of the array, a value is computed.

Reduceright ()

Shrinks the array from right to left.

Reverse ()

Reverses the order of the array elements in the original array.

Shift ()

Removes the first element of the divisor group.

Slice ()

Returns a portion of an array.

Some ()

Tests if there is at least one array element that can make the assertion function true.

Sort ()

Sorts an array element in the original.

Splice ()

Inserts, deletes, or replaces an array element.

toLocaleString ()

Converts an array to a localized string.

ToString ()

Converts an array to a string.

Unshift ()

Inserts an element at the head of the array.

Date

Method

Get[utc]date ()

Returns the date value, either local or world time, in the month of the date object.

Get[utc]day ()

Returns the date value, either local or world time, of the week of the date object.

Get[utc]fullyear ()

Returns the year of the date, the full 4-digit format, local or world time.

Get[utc]hours ()

Returns the value of the Date object, local or world time.

Get[utc]milliseconds ()

Returns the millisecond value of a Date object, either local or world time.

Get[utc]minutes ()

Returns the minute value of a Date object, either local or world time.

Get[utc]month ()

Returns the month value of a Date object, either local or world time.

Get[utc]seconds ()

Returns the second value of a Date object, either local or world time.

GetTime ()

Returns the internal milliseconds representation of a Date object. Note that this value is independent of the time zone, so there is no separate get[utc]time () method.

getTimezoneOffset ()

Returns the number of minutes between the local representation of the current date and the UTC representation. Note that the return value depends on whether daylight saving time is valid for the specified date.

GetYear ()

Returns the year value of a Date object. This method is obsolete and it is recommended to use getFullYear ().

Set[utc]date ()

Sets the date value for the month of the date, using local or world time.

Set[utc]fullyear ()

Sets the year of the date (and optionally the month and date) values, using local or world time.

Set[utc]hours ()

Set the time value for the date (and optionally the minute, second, and millisecond values), using local or world times.

Set[utc]milliseconds ()

Sets the millisecond value of the date, using local or world time.

Set[utc]minutes ()

Sets the minute value of the date (as well as the optional second and millisecond values), using the Earth or world time.

Set[utc]month ()

Set the month value for the date (and the number of days in the optional month), using local or world time.

Set[utc]seconds ()

Sets the second value of the date (and the optional millisecond value), using local or world time.

SetTime ()

Sets the value of a Date object using the format of milliseconds.

Setyear ()

Sets the year value of a Date object. Deprecated, it is recommended to use setFullYear ().

toDateString ()

Returns a String that represents the date part of the current date, using the local time zone.

toGMTString ()

Converts a date to a string using the GMT time zone. Deprecated, it is recommended to use toUTCString ().

Toisostring ()

Converts a date to a string, using the ISO-8601 standard to combine the day/Time format and UTC.

ToJSON ()

Serializes a Date object JSON, using Toisostring ().

toLocaleDateString ()

Returns a String that represents the date part of the current date, using the local time zone, in the local times format.

toLocaleString ()

Converts a date to a string, using the local time zone and the local times format.

toLocaleTimeString ()

Returns a String that represents the time portion of the current date, using the local time zone and the local times format.

ToString ()

Converts a date to a string using the local time zone.

toTimeString ()

Returns a String representing the time portion of a specified date, expressed in the local time zone.

toUTCString ()

Converts a date to a string, using world time.

ValueOf ()

Converts a date to the corresponding internal millisecond format.

Static methods

In addition to the example methods listed above, the Date object defines three gesture methods. These methods are called through the date () constructor itself, rather than through the individual date objects.

Date.now ()

Returns the current time, the number of milliseconds since the beginning of the era.

Date.parse ()

Parses a string representation of a date and time, returning the internal millisecond representation of the date.

DATE.UTC ()

Returns the millisecond representation of the specified UTC date and time.

Function

Property

Arguments[]

An array of arguments passed to the function. It is not recommended.

Caller

A reference to a function object that invokes the functions. If it is a global call, the property is null. It is not recommended.

Length

The number of parameters specified when declaring a function.

Prototype

An object to use for the constructor. All objects created with the constructor share the properties and methods defined by the prototype object.

Method

Apply ()

Invokes a function as a method of the specified object. Passed to it is the specified array of arguments.

Bind ()

Returns a new function. Invokes the method as a method of the specified object, with an optional specified parameter.

Call ()

Invokes a function as a method of the specified object. Passed to it is the specified parameter.

ToString ()

Returns a string representation of a function.

Global

Global Properties

Infinity

A numeric value that represents positive infinity.

NaN

Represents a value that is not a value.

Undefined

The Undefind value.

Global functions

decodeURI ()

Decodes a string that is escaped using encodeURI ().

decodeURIComponent ()

Decodes a string that is escaped using encodeURIComponent ().

encodeURI ()

Encodes a URI by escaping a specific character.

encodeURIComponent ()

Encodes part of a URI by escaping a specific character.

Escape ()

Encodes a string by replacing a specific character with an escape sequence.

Eval ()

Executes the JavaScript code string, returning the result.

Isfinite ()

Determines whether a value is infinitely large.

IsNaN ()

Determines whether a value is non-numeric.

Parsefloat ()

Parses a numeric value from a string.

parseint ()

Resolves an integer from a string.

Unescape ()

Decodes a string using escape () encoding.

Global objects

Array

Array () constructor.

Boolean

Boolean () constructor.

Date

The Date () constructor.

Error

The Error () constructor.

Evalerror

The Evalerror () constructor.

Function

function () constructor.

Json

Refers to an object that defines the functions that parse and serialize the JSON.

Math

Refers to an object that defines a mathematical function.

Number

Number () constructor.

Object

The Object () constructor.

Rangeerror

The Rangeerror () constructor.

Referenceerror

The Referenceerror () constructor.

Regexp

The RegExp () constructor.

String

String () constructor.

SyntaxError

The SyntaxError () constructor.

TypeError

The TypeError () constructor.

Urierror

The Urierror () constructor.

Math

Constant

Math.e

Constant E, the base of the natural logarithm.

Math.ln10

Natural logarithm of 10.

Math.ln2

Natural logarithm of 2.

math.log10e

E The logarithm of the base 10.

math.log2e

E The logarithm of the base 2.

Math.PI

Constant.

Math.sqrt1_2

The reciprocal of the square root of 2.

Math.sqrt2

Square root of 2.

static functions

Math.Abs ()

Calculates the absolute value.

Math.acos ()

Calculates the inverse cosine value.

Math.asin ()

Calculates the inverse chord value.

Math.atan ()

Calculates the inverse tangent value.

Math.atan2 ()

Calculates the angle from the x-axis to the specified point.

Math.ceil ()

Rounding a number up.

Math.Cos ()

Calculates the cosine value.

Math.exp ()

Calculates the exponentiation of E.

Math.floor ()

Rounding down a number.

Math.log ()

Calculates the natural logarithm.

Math.max ()

Returns the larger of the two numbers.

Math.min ()

Returns the smaller of the two numbers.

Math.pow ()

Calculates the x^y.

Math.random ()

Calculates a random number.

Math.Round ()

Rounded.

Math.sin ()

Calculates the sine value.

MATH.SQRT ()

Calculates the square root.

Math.tan ()

Calculates the tangent value.

Object

Property

Constructor

Refers to the constructor of the current object (a JavaScript function).

Method

hasOwnProperty ()

Checks whether the object has a property that specifies the local definition of the name, rather than the inheritance.

isPrototypeOf ()

Checks that the current object is not a prototype of the specified object.

propertyIsEnumerable ()

Checks whether the property of the specified name exists and can be enumerated with for/in.

toLocaleString ()

Returns a localized string representation of the object. The default implementation of this method simply calls ToString (), but the subclass can overwrite it to provide a localized implementation.

ToString ()

Returns a string representation of the object. This method implemented by the object class is very broad and does not provide much useful information. Subclasses of object typically overwrite it with a custom ToString () method to provide more useful

Output information.

ValueOf ()

Returns the original value of the current object, if the original value exists. For objects of type object, this method simply returns the object itself. The subclass of object, such as number, Boolean, overrides this method to return the original value associated with the object.

Static methods

Object.create ()

Creates a new object with the specified prototype and attributes.

Object.defineproperties ()

Creates or configures one or more properties of the specified object.

Object.defineproperty ()

Creates or configures a property of the specified object.

Object.freeze ()

Sets the specified object to not be changed.

Object.getownpropertydescriptor ()

Queries the attributes of the specified property of the specified object.

Object.getownpropertynames ()

Returns an array that contains all the non-inherited property names for the specified object, including non-enumerable properties.

Object.getprototypeof ()

Returns the prototype of the specified object.

Object.isextensible ()

Checks whether the current object can be added to the new property.

Object.isfrozen ()

Checks whether the current object is frozen.

Object.issealed ()

Checks whether the specified object is closed (sealed).

Object.keys ()

Returns an array that contains all the non-inheritable enumerable property names for the specified object.

Object.preventextensions ()

Prevents new properties from being added to the specified object.

Object.seal ()

Prevents the addition of new properties to the specified object or removes existing properties.

String

Property

Length

The number of characters in the string.

Method

CharAt ()

Extracts a character in a string at the specified position.

charCodeAt ()

Returns the encoding of the character at the specified position in a string.

Concat ()

Concatenate one or more values into a string.

IndexOf ()

Looks for a character or substring in the specified string.

LastIndexOf ()

Looks backwards in the specified string for a character or substring.

Localecompare ()

Compares strings using locally defined order.

Match ()

Performs pattern matching using regular expressions.

Replace ()

Use a regular expression to perform a find-and-replace operation.

Search ()

Finds a substring in a string that matches a regular expression.

Slice ()

Returns a slice or substring of a string.

Split ()

Breaks at the specified delimiter string or regular expression, dividing a string into an array of strings.

SUBSTR ()

Extracts a substring of a string, a variant of substring ().

SUBSTRING ()

Extracts a substring of a string.

toLowerCase ()

Returns a copy of the specified string in which all characters have been converted to lowercase.

ToString ()

Returns the original string value.

toUpperCase ()

Returns a copy of the specified string in which all characters have been converted to uppercase.

Trim ()

Returns a copy of the specified string, with both front and back whitespace characters removed.

ValueOf ()

Returns the original string value.

Static methods

String.fromCharCode ()

Creates a new string using the character encoding passed in as a parameter.

HTML method

Since these are not standard methods, they do not have a separate reference entry in the following pages:

Anchor (name)

Returns a copy of the string in a environment.

Big ()

Returns a copy of the string in an environment.

Blink ()

Returns a copy of the string in an environment.

Bold ()

Returns a copy of the string in an environment.

Fixed ()

Returns a copy of the string in an environment.

FontColor (color)

Returns a copy of the string in a environment.

FontSize (size)

Returns a copy of the string in a environment.

Italics ()

Returns a copy of the string in an environment.

Link (URL)

Returns a copy of the string in a environment.

Small ()

Returns a copy of the string in an environment.

Strike ()

Returns a copy of the string in an environment.

Sub ()

Returns a copy of the string in an environment.

SUP ()

Returns a copy of the string in an environment.

JavaScript Core Reference

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.