Basic object Number, String, Array, Math, Date, Function definition, global variable

xiaoxiao2021-03-06  15

1.Number - Property ---- Max_Value Usage: Number.max_Value; Returns "Maximum". ---- Min_Value Usage: Number.min_Value; Returns "Minimum". ---- NAN usage: Number.nan or nan; return "nan". "Nan" (not a value). ---- Negative_Infinity Usage: Number.negative_infinity; Return: Negative infinity, a small value smaller than the "minimum value". ---- Positive_infinity usage: Number.positive_infinity; Return: Your greater value is greater than "maximum". - Method ---- TOSTRING () Usage: .tostring (); Returns: Numerical Values ​​in String. Such as: if a == 123;, a.toString () == '123'.

2.String - Properties ---- Length Usage: .length; Returns the length of the string. - Method ---- Charat () Usage: .CHARAT (); Returns the string at the list of bit> bits. Note: One of the characters in the string is 0th, the second is the first bit, the last character is the first LENGTH - 1 bit. ---- Charcodeat () Usage: .Charcodeat (); Returns the string in the ASCII code of a single character of the bit> bit. ---- fromcharcode () usage: string.fromcharcode (A, B, C ...); returns a string, the ASCII code of each character is determined by A, B, C ..., etc.. ---- IndexOf () Usage: .indexof ( [, ]); This method looks out from (If you give ignore the previous position), if you find it, return it to its location, and return "-1" if you find it. All "locations" are started from zero. ---- LastIndexof () Usage: .laastIndexof ( [, ]); similar to indexof (), but start from behind. ---- Split () Usage: .split (); Returns an array, the array is separated from , Decision Where it is separated, it does not contain in the returned array. For example: '1 & 2 & 345 & 678'.Split (' & ') Returns Array: 1, 2, 345, 678. Regarding arrays, let's wait a discussion. ---- Substring () Usage: .substring ( [, ]); return to the original string sub-string, the string is the original string from position to position. - = Returns the length of the string (Length). If not specified or specify exceeding the string length, the sub-string from positions from the primary string. If the specified location cannot return a string, return an empty string. ---- SubStr () Usage: .substr ( [, ]); return the sub-string of the original string, the string is the original string from position The length of the length is . If not specified or specified exceeds the string length, the sub-string from positions from the original character tail. If the specified location cannot return a string, return an empty string. ---- TOLOWERCASE () Usage: .tolowerCase (); Return to all uppercase letters all uppercase letters into lowercase strings.

---- TouPpercase () Usage: .touppercase (); Return to the original string all lowercase letters all override strings. 3.Array - Definition ---- Var = new array (); ---- JavaScript only one-dimensional number of groups! - Quote ---- [] = ...; - Property ---- Length Usage: .length; Return: Around the length, ie how many groups Element. It is equivalent to adding a subscript of the last element in the array. So, I want to add an element, just: myarray [myarray.length] = .... - Method ---- Join () Usage: .join (); Returns a string that strings each element in the array, placed in the element with Between the elements. This method does not affect the original content of the array. ---- Reverse () Usage: .reverse (); Make the elements in the array. If you use this method to the array [1, 2, 3], it will make the array into: [3, 2, 1]. ---- SLICE () Usage: . Slice ( [, ]); returns an array, the array is the subset of the original number group, starting from , finally . If not given , the subset will be taken to the end of the original number group. ---- Sort () Usage: .sort ([]); Make elements in the array in a certain order. If is not specified, it is arranged in alphabetical order. In this case, 80 is prior to 9. If you specify the , select the sort method specified by .

4. Math - attribute ---- e Return constant E (2.718281828 ...). ---- LN2 Returns 2 of the natural logarithmic (LN 2). ---- LN10 returns 10 of the natural logarithm (LN 10). ---- LOG2E Returns the log (LOG2E) of E.s. ---- LOG10E Returns the log (log10e) of E of E. ---- Pi returns π (3.1415926535 ...). ---- SQRT1_2 Returns 1/2 of square root. ---- SQRT2 returns 2 square roots. - Method ---- ABS (x) Returns the absolute value of x. ---- ACOS (X) Returns the anti-rest value of the X (cosine value equal to X), indicated by an arc. ---- asin (x) Returns the U. ---- Atan (x) Returns an unstective value of x. ---- Atan2 (X, Y) Returns the plurality of incompatants corresponding to the internal point (x, y), represented by an arc, its value is between -π to π. ---- CEIL (X) Returns the minimum integer greater than equal to X. ---- COS (X) Returns the cosine of X. --- Exp (x) Returns the X Power (EX) of E. ---- Floor (x) returns the maximum integer that is less than equal to X. ---- log (x) Returns the natural logarithm (LN X) of X. ---- Max (a, b) returns a large number of A and B. ---- min (a, b) returns smaller number in A and B. ---- Pow (n, m) Returns the M Power (NM) of N. ---- Random () returns a random number greater than 0 less than 1. ---- Round (x) Returns the value of the four rounds. ---- sin (x) returns the sinusoidal of x. ---- SQRT (x) Returns the square root of x. ---- Tan (x) Returns the peer of X.

5.Date - definition ---- var d = new date; ---- var d = new date (99, 10, 1); // 99 October 1 ---- VAR D = New Date ('OCT 1, 1999); // October 1, 99 - Method ---- g / set [utc] fullear () returns / set the year, expressed with four digits. If "X.Set [UTC] Fullyear (99) is used, the year is set to 0099. ---- g / set [utc] year () returns / set the year, expressed in two digits. When setting, the browser automatically adds "19" starting, so use "X.Set [UTC] Year (00)" to set the year to 1900. ---- g / set [utc] month () returns / set the month. ---- g / set [utc] date () returns / set the date. ---- g / set [utc] day () returns / set the week, 0 means Sunday. ---- g / set [utc] Hours () returns / sets hours, 24 hours. ---- g / set [utc] minutes () returns / sets the number of minutes. ---- g / set [utc] seconds () returns / sets the number of seconds. ---- g / set [utc] MilliseConds () returns / sets the number of milliseconds. ---- g / setTime () returns / setup time, this time is the internal processing method of the date object: the number of milliseconds that calculate the date of the date object referred to from January 1, 1970. If you want to delay the time of a certain object refers to 1 hour, use: "x.settime (x.gettime () 60 * 60 * 1000);" (One hour 60 points, one minute 60 seconds, 1000 1000 millisecond). ---- GetTimezoneOffset () Returns the number of minutes from the time zone adopted by the date object and Greenwich time. In the urban area of ​​Greenwich orientation, this value is negative, for example: China Time Zone (GMT 0800) returns "-480". ---- toString () Returns a string that describes the date referred to by the date object. The format of this string is similar to: "FRI JUL 21 15:43:46 UTC 0800 2000". ---- TOLOCALESTRING () Returns a string, describing the date referred to by the date object, using local time to format. Such as: "2000-07-21 15:43:46". ---- TogMTString () Returns a string, describing the date referred to by the date object, with the GMT format. ---- ToutCString () Returns a string, describing the date referred to by the date object, using the UTC format. ---- Parse () Usage: Date.Parse (); Returns the internal expression of the date object. 6. Function - Define Functions Use the following statement: Function function name ([parameter set]) {... [return [];] ...}

7. Global Variables - Variables defined by the "VAR" statement of the "Root" (non-function inside) of Script are global variables, which can be called, change anywhere throughout the process.

转载请注明原文地址:https://www.9cbs.com/read-46121.html

New Post(0)