Simple recording for quick review.
// numerical expansion: console.log (// finite, integer, non-digital judgment Number.isFinite(10), Number.isInteger(12), Number.isInteger(12.1), Number.isNaN (NaN), Number.isNaN(10) ) console.log (// judged positive, negative, 0 Math.sign(2), Math.sign(0), Math.sign(-1), Math.sign('2'), // 1 Math.sign('abc') //NaN ) console.log (// get the integer part of a decimal Math.trunc(1.2), Math.trunc(4.2) // 4 ) // array expansion console.log( Array.of(1,2,3,4), // [1, 2, 3, 4] Array.of(), // [] Array.from ( 'a'), // set into an array Array.from("http1,http2,http3",item => item.split(',')), Array.from ([1,2,3], (item) => item * 2) // accepts two parameters, function map array operation ) console.log( [1,2, undefined] .fill (7), // [7,7,7] Replace [ 'A', 'b', 'c', 'd', 'e']. Fill (1,0,3), // 0 from the position 3 to the position of the element, replace 1 [1,2,3,4,5,6,7,8].fill(0,1,2) ) { // keys、values、entries for(let idx in ['a','b','c'].keys()) { console.log('idx',idx) } for(let value in ['a','b','c'].values()) { console.log('value',value) } for(let [index,value] in ['a','b','c'].entries()) { console.log(` index: ${index}, value: ${value} `) } } { // find findIndex includes console.log( [1,2,3,4].find(item => item > 2) ) console.log( [1,2,3,4].findIndex( item => item>2 ) ) console.log( [1,2,3,4].includes(2) ) console.log ([1,2,3, in] .includes (In)) // true } { Alternatively // the index of the element 0, element is used to replace the index between 2 (including 2) the subscript 3 console.log( [1,2,3,'a'].copyWithin(0,2,3)) // [3,2,3,'a'] }