Category: array methods

ES6 in Action: New Array.* and Array.prototype.* Methods

In this article, we’ll discuss most of the new methods available in ES6 that work with the Array type, using Array.* and Array.prototype.*. When discussing them, I’ll write Array.method() when I describe a “class” method and Array.prototype.method() when I outline an “instance” method. We’ll also see some...

Quick Tip: How to Sort an Array of Objects in JavaScript

If you have an array of objects that you need to sort into a certain order, the temptation might be to reach for a JavaScript library. Before you do however, rember that you can do some pretty neat sorting with the native Array.sort function. In this article I’ll show you how to sort an array of objects in Java...

Filtering and Chaining in Functional JavaScript

One of the things I appreciate about JavaScript is its versatility. JavaScript gives you the opportunity to use object oriented programming, imperative programming, and even functional programming. And you can go back and forth among them depending on your current needs and the preferences and expectations of your team...

Using Map and Reduce in Functional JavaScript

This article was peer reviewed by Panayiotis Velisarakos, Tim Severien and Dan Prince. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! With all the talk about workflows that support the amazing new features in ECMAScript 6, it’s easy to forget that ECMAScript 5 broug...

Quick Tip: How to Create and Manipulate Arrays in JavaScript

This article was peer reviewed by Chris Perry and Marcello La Rocca. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! The length property of Array objects is one that many who are relatively new to JavaScript do not understand. Many mistakenly believe that the length te...

Getting Started with Underscore.js

This article was peer reviewed by Agbonghama Collins and Ryan Chenkie. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! Underscore.js is a JavaScript library, written by Jeremy Ashkenas, that provides functional utilities for a variety of use cases that we, as developers, m...

Lose the jQuery Bloat ­— DOM Manipulation with NodeList.js

In recent years, jQuery has become the de-facto JavaScript library on the web. It irons out many cross-browser inconsistencies and adds a welcome layer of syntactic sugar to client-side scripting. One of the main pain points it abstracts away is DOM manipulation, but since its inception, native browser APIs have impro...