"JavaScript webpage production thorough research" learning 2

zhaozj2021-02-16  58

Chapter 5, JavaScript built-in object

1. JavaScript Type of Built-in Object

The implicit object such as Var str = "javascript" does not support the Prototype and Expando properties

Objects created by New instructions

2.JavaScript built-in object

Boolean object objboolean = new boolean () Boolean value for false, 0, null, nan or empty string is false, otherwise true

Function object 1, function mod (x, y) {

Return (X% Y);

}

Second, VAR MOD = New Function ("X", "Y", "Return (X% Y)");

Global objects do not need to be established using the New instruction. This object is automatically established after the Script engine is initialized. Global object has two properties

Infinity gets the initial value of Number.positive_infinity

NAN gets the initial value of Number.nan

The properties of the Global object do not have to specify the Global object, and use the attribute name directly.

Number objects typically, we use the Number object to use the toString () method. Attributes:

MAX_VALUE Returns the maximum value of the JavaScript value, about 1.79E 308

Min_Value Returns the value of JavaScript closest to 0, about 5.00e-324

Nan This is a special value, indicating that the expression or variable value is not a value.

Negative_infinity Returns a bigger negative value than -Number.max_Value

Positive_infinity Returns a bigger positive value than Number.max_Value

Object objects can establish objects supported by JavaScript

Regexp Objects JavaScript Standard Language (Regular Expression) object.

String Object String object provides a series of formatted methods:

Anchor (), BIG (), Blink (), Bold (), Fixed (), FontColor (Color), Fontsize (size),

ITALICS (), LINK (URL), Small (), Strike (), SUB (), SUP ()

String length, uppercase and search:

Length gets the length of the string, TOLOWERCASE (), TouPercase ()

Charat (index) get the character index value of the parameter index position starts from 0,

Charcodeat (INDEX) gets the parameter index location Unicode unified encoding

IndexOf (String, INDEX) Returns the index location of the string for the first time. Did not return -1. INDEX is the location where you start searching.

LastIndexof (String)

Match (string) with indexof, returns a found string. No NULL returns.

Search (String) with indexof

String processing:

Replace (String1, String2) finds String1 replacement to string2

Split (string) Split Returns Array array

Substr (INDEX, Length) starts Length character from Index

Substring (Index1, Index2) Removes the string between Index1 to Index2

Concat (SRING) Adds String Behind the String Object

Array object declaration var username = new array (5);

Array object properties and methods

Lengthjoin () Displays the elements of the array using the string mode display by ','

Reverse () reverse number group

Sort () sort

Concat (array)

Array object of multidimensional array JavaScript does not directly support multi-dimensional arrays but Array object elements can be another array object