Write a JavaScript program to check if the predicate (second argument) is truthy on all elements of a collection (first argument)

  • برمجة جافاسكربت java script
  • برمجة

Write a JavaScript program to check if the predicate (second argument) is truthy on all elements of a collection (first argument).

الأجوبة

const truthCheckCollection = (collection, pre) => collection.every(obj => obj[pre]);
console.log(truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], 'sex'));
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...