zf

时间:2024-03-25 12:16:18
【文件属性】:

文件名称:zf

文件大小:274KB

文件格式:ZIP

更新时间:2024-03-25 12:16:18

TypeScript

经典面试题: [[1,2,3],[4,5,6]]数组展开 let res = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] . reduce ( ( prev , next ) => { return [ ... prev , ... next ] } ) console . log ( res ) ; //[1,2,3,4,5,6] 减少 reduce方法使用的替代是附加不能为空 手写reduce函数 Array . prototype . myReduce = function ( fn , prev ) { for ( let i = 0 ; i < this . length ; i ++ ) { if ( typeof prev === 'undefined' ) { prev = fn ( this [ i ] , thi


网友评论