Write a JavaScript function that returns true if the provided predicate function returns true for all elements in a collection, false otherwise
- برمجة جافاسكربت java script
- برمجة
- 2021-06-03
- ahmadghneem
الأجوبة
const all = (arr, fn = Boolean) => arr.every(fn);
console.log(all([4, 2, 3], x => x > 1));
console.log(all([4, 2, 3], x => x < 1));
console.log(all([1, 2, 3]));
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال