Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const every = (array, func) => {
- let x = true
- array.forEach((item)=> {
- if(!func(item)){x = false}
- })
- return x;
- }
- const some = (array, func) => {
- let x = false;
- array.forEach((item)=>{
- if(func(item)){x = true}
- })
- return x;
- }
- console.log(every([1, NaN, NaN], isNaN))
- console.log(some([1,1], isNaN))
Add Comment
Please, Sign In to add comment