From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Every/some - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Every/some
- [Instructor] Next, we're going to look at two built-in array functions that are pretty similar. These functions are called every and some. We saw in a previous video how to use JavaScript's filter function to find the elements in an array for which a given condition is true. Finding all the even numbers in an array of numbers, for example. JavaScript's built-in every and some functions are similar to this in that we pass them a function that returns either true or false for each element. But the difference is that instead of returning an array, every and some return a single Boolean, true or false. Every returns true if and only if a given condition is true for every single element in our array. Otherwise, it returns false. So, for example, if we have an array of all odd numbers and we call every with a function that checks if a number is odd, it will return true. But if there's a single even number in our array, it will return false. And, of course, if the array contains all even…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
JavaScript: Functional parts1m 53s
-
(Locked)
The spread operator5m 30s
-
Mapping5m 11s
-
(Locked)
Filtering6m 59s
-
(Locked)
Every/some5m 46s
-
(Locked)
Slicing3m 38s
-
(Locked)
Sorting5m 11s
-
(Locked)
Reducing6m 23s
-
(Locked)
Combining functions6m 40s
-
(Locked)
Challenge: Recreate the map function1m 3s
-
(Locked)
Solution: Recreate the map function3m 6s
-
(Locked)
-
-
-