Boolean, number, Object
Function object
Another way to do this:
var add=new Function ("x", "Y", "Return (X+y)");
Arguments property: Real parameter Group
Math Object
Provide scientific functions and constants
Property:
E PI, etc.
Method:
ABS for absolute ceil (rounding up) floor (rounded down) round (round) POW (A, B) (returns a of the second party) random sqrt (square root)
String Object
Property:
Length
Method:
CharAt concat indexOf lastIndexOf replace (reexp,replacetext) search (rgexp) split substr (start[,length ]) substring (start,end) tolowercase touppercase valueOf ()
Match (RGEXP) (uses the regular expression pattern to find the string and returns the result of the lookup as an array)
RegExp Object
RegExp objects cannot be created directly, but can always be used. The initial value of each property before a successful regular expression lookup is:
Index-1
LastIndex-1
Lastmatch ""
Property:
Input: The last string found
Index: Find the first matching starting subscript
LastIndex: The next match that satisfies the condition begins, and returns 1 if there is no next occurrence
Lastmatch: Returns the last matched string
Leftcontext: A string that returns the beginning of the string to the end of the string before it matches the position
Rightcontext: Returns the first match ending position of the string to the end of the string character
RegExp Regular Expression Object
Structure:
Re=/pattern/[flags]
Re=new RegExp ("pattern", ["flags"])
Parameters:
Re: regular expression variable name
Pattern: The regular expression pattern used
Flag: Use Flag
G: Full text Find all occurrences of pattern
I: Ignore case
M: Multi-line Lookup
Method:
Rgexp.complie (Pattern,[flags]); Compiles a regular expression into an internal format, which executes faster and returns a regular expression object
Rgexp.exec (str): Runs a lookup in a string with a regular expression and returns an array containing the lookup object
var F1=NewFunction ("A", "B", "Return (A+B)")); //Alert (F1 (2,3)); //alert ("PI:" +math.pi); //alert ("E:" +MATH.E); //Alert (Math.Abs (-1)); //Alert (Math.ceil (1.23)); //Alert (Math.floor (1.67)); //Alert (Math.Round (1.45)); //Alert (MATH.SQRT (4)); //alert (Math.pow (2,3));var s=NewString ("Gjhdgsjkdgsjgfs"); //alert (s.length); //Alert (S.charat (3)); //Alert (S.concat ("HLKHK")); //There's been a mistake.var re=/"JH"/G; Re=NewRegExp ("JH", "G"); //alert (S.replace (re,h));alert (re.index);</script>
View Code
Application of JS built-in object