1. Array sorting
Array---the sort () method;
1> sorts the letters using the Sort method:
var arr=new Array (6)
Arr[0]=a. Arr[1]= ...
Arr.sort ();
To be discharged in a A-Z order
2> sorts numbers by using the Sort method:
Arr.sort (sortnumber); Sort the numbers from small to large.
3> If you sort by other criteria, you need to provide a function,
Arr.sort (function () {});
This function returns a value greater than 0 from the large to the small sort;
Values less than 0 are sorted from small to large;
Arr.sort (function (b) {
return a-B;
});
4> the JSON object (where the JSON object has been converted to a string form)
A and B can be regarded as a less than B;
if: arr=[{score:30},{score:60},{...},{...},{...}]
Can do this:
Arr.sort (function (b) {
return a.score-b.score;
});
An array of JSON objects is sorted by a property to this set of JSON objects.
2. Which conditions will generate BFC
1> root element (body itself is a BFC)
2> the Float property is not none;
3> position for absolute or fixed
4> Display for Inline-block,table-cell,table-caption,flex,inline-flex
5> overflow is not visible;
3, how to use Localstorage to store an object
1> creating an array in Localstorage
var players=localstorage.players;
if (!players) {
Players=[];
}
2> put the value of an array into an array
var p={name:111,score:222}
Players.push (P);
3> to convert objects to string form
Localstorage.players=json.stringify (players);
4. How to convert objects in string form to JSON objects
Players=json.parse (players);//Refer to the above players.
5. CSS Selector priority level
1> inline style special value 1000;
2> ID Selector special value 0100;
3> Class (pseudo Class) selector special value 0010;
4> element Selector special value 0001;
Rookie front-end programmer small Knowledge point brocade set two