Today is the first day to write a blog!
It's so hard to understand what kind of feeling it is. Tt,c++ and Java are not the foundation.
Summary:
1: Object is a value of reference type
2.Object type (base type)
Methods of accessing properties: Person.name;
person["name"]//for property names with illegal characters
3.Array Type:
The A.length property is not just readable and can be used to add or remove items. Eg:var Num=[red,blue,green]; color.length=2; Alert (color[2]);//undifined
B. Detecting array: instanceof array. or Array.isarray
The C.tostring method returns a comma-delimited string------------the Color.join ("|")//"Red|blue|green" default comma. ------------------valueof Returns an array
D.lifo and FIFO
Push (), pop (), shift () front end add unshift () front end delete;
Eg:var colors=new Array ();
var count=colors.unshift ("Red", "green");
Count=colors.unshift ("Black")//black,red,green
E. Reorder reverse () reverse order; sort () compares a string to accept a comparison function. The first parameter should return a negative number before the second, returning 0 as the same, or a positive number
function Compare (value1,value2) {
return value2-value1; Positive order
}
F. Operation Method Concat ()//stitching does not affect the original array
Slice () Eg:var colors=["Red", "green", "blue", "yellow", "purple"] Colors.slice (1,4)//green,blue,yellow Baotou not wrapped tail
Splice () Eg:var colors=["Red", "green", "Blue"] colors.splice ("Red", "purple")//red red purple;
G. Location method: IndexOf lastIndexOf not found return-1, will use = = =;
H. Iterative methods, the values of the array are not modified every filter ForEach map some
I. Attribution method: Reduce reduceright//start with the last item
eg var values[1,2,3,4,5]; var sum=values.reduce (function{(Prew,cur,index,array)
Return prew+cur})//sum=15;
4.Date type
5.RegExp type g: Global----------I: Ignore case mode--------------m multiline mode (\ escaped)
JS Reference type Learning