Posts for ES6

javascript array helper - every and some

Javascript Array Helper every() and some()

The every() and some() array helpers are somewhat similar so I will discuss them both in this post. Both of these array helpers return a boolean result. The purpose of the every() array helper is to execute a function for every array element and test if it meets…

javascript array helper - reduce

Javascript Array Helper: reduce()

The reduce array helper is probably the most difficult of the array helpers to explain and understand. The purpose of the reduce() array helper is to execute a function for every array element and reduce the entire array to a single value. A Practical Example Suppose we have…

javascript array helper - find

Javascript Array Helper: find()

The purpose of the find() array helper is to execute a function for every array element and return a the first array occurrence which matches your specified condition. A Practical Example Suppose we have an array of products and we want to find the first product with a…

javascript array helper - filter

Javascript Array Helper: filter

The purpose of the filter() array helper is to execute a function for every array element and return a new array containing only those elements that match a condition. A Practical Example Suppose we have an array of products and we want to create a new array of…

javascript array helper - map

Javascript Array Helper: map

The purpose of the map() array helper is to execute a function for every array element and return a new array. The key to remember with this method is that a new array will be returned (you are not changing the original array). A Practical Example Suppose we…

javascript array helper - foreach

Javascript Array Helper: forEach

Looping or iterating through an array is a very common task you often need to do in javascript. ES6 javascript provides a handy array helper function for this…. the forEach. First, let’s look at how we would do this in older ES5 javascript. Javascript forEach Helper Now iterating…