algorithms/truthCheck.js

7 lines
237 B
JavaScript
Raw Normal View History

2024-01-12 07:01:06 -05:00
function truthCheck(collection, pre) {
return collection.every(function (user) {
return user.hasOwnProperty(pre) && Boolean(user[pre])
});
}
console.log(truthCheck([{"single": "double"}, {"single": NaN}], "single"));