Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var personNames = []; 
var persons = [{"firstname": "john", "id": "111"}, {"firstname": "doug", "id": "777"}, {"firstname": "smith", "id": "888"}];
if(persons.length > 0){
  persons.forEach(function(person){
    //use personName locally
    var personName = {};
    personName.name = person.firstname;
    personNames.push(personName);
  });
}
console.log(personNames);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers