Languages
[Edit]
EN

JavaScript - forEach over array with objects

3 points
Created by:
Dirask Community
4320

In this article, we would like to show you forEach() method used to loop over an array with objects in JavaScript.

The forEach() method calls provided function once for each element of an array. In this case, we have an array of objects.

Runnable example:

// ONLINE-RUNNER:browser;

var users = [
	{name: 'Thomas', age: '21'},
	{name: 'Mark', age: '35'}
];

users.forEach((user) => {
	console.log(user.name, user.age);
});

Note:
Here you can read more about how to use forEach.

See also

  1. JavaScript - how to use foreach? 
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join