timoxley/functional-javascript-workshop

using every and some

hmntptwl opened this issue · 0 comments

I did it this way

function checkUsersValid(goodUsers) {
      return function allUsersValid(submittedUsers) {
var a=goodUsers.map(function(v){
    return v.id;
})
var b=submittedUsers.map(function(x){
    return x.id;
})
return b.every(function(z){
  return a.indexOf(z) > -1;
})
   
      };
    }

My solution to Basic :Call was like this

   function duckCount(...arg) {
       var c = 0 ;
      [...arg].forEach(function(v,i){
    if(Object.prototype.hasOwnProperty.call(arg[i],'quack'))  
           c++;
       })
       
     return c;
    }