JavaScript Objects and Arrays Manipulation for REST API

Viacheslav Luschinskiy
7 min readJan 19, 2020

JavaScript objects and arrays manipulation can be complex but it is the essential part of any frontend application that deals with REST API. It can become even more complex if you add immutability requirement imposed by the most modern JavaScript frameworks like React and Angular.

From the other hand when working with REST API you do mostly the same things like CRUD operations (Create, Read, Update, Delete) and some other transformations, so you don’t have to learn everything about objects and arrays before you start building the apps.

In this article I will show how to professionally manipulate objects and arrays with the modern JavaScript including ES2020, as well as with the most popular Lodash library in the scope of the common REST API tasks. I’ll skip all the basics and focus on the more complex and interesting parts.

Do we still need Lodash or we can get away with just the modern JavaScript? That is the question that we will try to answer at the end of this article as well.

You can play with all the examples in this article by cloning the accompanying git repo.

Let’s now see how we can read and send data to the backend REST API. We will first have a look at how to do all the CRUD operations and then move on to the more complex…

--

--