<div></div>function filter2(array, callback){ let newArr =[]; for(let i=0;i<array.length;i++){ if(callback(array[i],i,array)){ newArr.push(array[i]); } } return newArr; } callback(value){ return value>2 } filter2([1,2,3]) var arr = [1,2,3]; arr.filter2((value)=>{ return value>2 })
Saturday, July 14, 2018
Subscribe to:
Post Comments (Atom)
Day 13
(2) so is that possible to build it from scratch? (3) is that mean it’s better to do that by service? how about if i want to find a API? ...
-
Day 9 (1) The arrow function won't bind this (2)The argument in arrow function (3)non-blocking (4)try and catch (5)inspect Ques...
-
(2) so is that possible to build it from scratch? (3) is that mean it’s better to do that by service? how about if i want to find a API? ...
-
<div></div> function filter2 ( array , callback ) { let newArr = [ ] ; for ( let i = 0 ; i < array. length ; i ++ )...
No comments:
Post a Comment