String method:
Str.length
Str.charat (i): takes one of the strings;
Str.indexof (' e '); Find the first place to appear; return-1 is not found;
Str.lastindexof (' e '): Find the last position where e appears; return-1 is not found;
Str.touppercase (); turn caps
Str.tolowercase (); Turn lowercase
Str.substring (starting position, end position): string interception;
Str.split (' Cut Way '); string cut; string-to-array;
Array method:
Delete: Arr.splice (start position, number of deletions);
Added: Arr.splice (the beginning of the position [to which the front of the add],0, element 1);
Replacement: Arr.splice (start position, number of deletions, element 1);
Arr.sort (function (n1,n2) {return n1-n2}): Sort
Arr.reverse (): Flip
Arr.push (); Add a bit to the back of the array;
Arr.unshift (): Adds a bit to the front of the array;
Arr.pop (): Deletes a bit from the back of the array;
Arr.shift (): Deletes a bit from the front of the array;
Arr.join (' Connected way '); array-to-string method;
Arr.concat (arr1,arr2); array connections;
6. Mathematical Methods:
Math.random (); random number;
Math.Round (): rounded;
Math.ceil () upward rounding;
Math.floor () downward rounding;
Math.Abs (): Take absolute value;
Math.max (x, y): Maximum number;
Math.min (x, y), minimum number;
Math.pow (x, y): several times;
MATH.SQRT (): Open square;
Array: Store multiple things;
JSON: Save multiple things;
JSON = {
Key-value pairs
name1[keys, key]:value1[values, value],
name2[keys, key]:value2[values, value],
}
The difference between JSON and arr:
1:lengthundefinedarr.length;
2: The way of subscript attribute arr[0];
3: The order has no order in order;
4: Loop for infor,while,for in
The For In loop can also loop an array, but it is not recommended because the performance is slightly lower;
JS Small Features:
Comma expression: see only the value after the last comma;
JavaScript---basic syntax