Tutorial by Examples

_.map is useful for changing a list into a different list in a purely declarative way. Rather than using imperative techniques like a while or for loop in javascript, you can just specify how you want to manipulate an element of a list and Use _.map to make a new list transformed by the functio...
Filtering a list down to only the elements we want to do. Lodash provides a function called _.filter filters elements based on the predicate function you provide. A predicate is a function that takes data in and returns either true or false. Let's look at how we'd get just the even numbers from...
We can assert some predicate over a collection using _.some to check if there is at least one member of a collection that meets some criteria. This is great when writing business logic to assert certain conditions on a group of objects. For example, let's say you wanted to make sure at least one...
Reducing a list to a single value is easy when you have _.reduce. Let's say we wanted to see if a group of people could afford a cab ride. We'd want to look at all the money they have together as a group, which means we'd want to reduce a list of objects to a single value, in this case the sum ...

Page 1 of 1