Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. const every = (array, func) => {
  2. let x = true
  3. array.forEach((item)=> {
  4. if(!func(item)){x = false}
  5.  
  6. })
  7. return x;
  8.  
  9. }
  10.  
  11. const some = (array, func) => {
  12. let x = false;
  13. array.forEach((item)=>{
  14. if(func(item)){x = true}
  15. })
  16. return x;
  17. }
  18. console.log(every([1, NaN, NaN], isNaN))
  19. console.log(some([1,1], isNaN))
Add Comment
Please, Sign In to add comment