// instead of
math.round(math.random*50)// use~~(math.random*50)
You can also use the “~~” operator to convert anything into a number value.
Example snippet:~~('whitedress')// returns 0~~(NaN)// returns 0
~~1.6 === 1
Array.length
var array =[a, b, c, d, e, f, g, h, i , j];
console.log(array.length);// returns the length as 10
array.length =4;
console.log(array.length);// returns the length as 4
console.log(array);// returns “a,b,c,d”
大数组不要使用concat 应该使用push
var list1 =[a, b, c, d, e];var list2 =[f, g, h, i, j];
console.log(list1.push.apply(list1, list2));// returns the merged values of both arrays (a, b, c, d, e,f, g, h, i, j)
真 - 牛人说的话 There’s absolutely no way I could pass the coding interview at any of the big tech companies. Even the ones where the interviewer learned to code from one of my tutorials.