forEach map filter reduce

filter

 let nums = [ 1, 2, 3, 4 ];
 let ret = nums.filter((n) => { return n % 2 === 0 ? true : false; });
 console.log(ret);
 
 [ 2, 4 ]
 let nums = [ 1, 2, 3, 4 ];
 let ret = nums.filter((n) => { return true; });
 console.log(ret);
 
 [ 1, 2, 3, 4 ]
 let nums = [ 1, 2, 3, 4 ];
 let ret = nums.filter((n) => { return false; });
 console.log(ret);
 
 []

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS