Being a JavaScript programmer, it's always important to know how to deal with an array of objects. In our day-to-day programming, we all come across an array of objects in one way or another. For example, the data coming from an API is in a JSON format, which is pretty much similar to an array of objects. So, let's take a look at how we can play around with array of objects. Before continuing it's mandatory to have some basic knowledge of map(),filter(),reduce() methods. You can also refer my article on these methods
1.Getting All the Employees Names:
2.Getting All Employees Name Whose Salary Is 10000
3.Finding Sum of All Salaries:
4.Finding the Employees from The Same City and Increase Their Salary by 5000
5.Filter Employees by array of ids:
6.Let's take a look at how we can remove duplicate objects
In the above array of objects, we can see that we have two similar objects.one of them can be removed by using the following method
here we can see that when we log the result, we get the array of objects with no duplicates
Top comments (0)