Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var IMDBShows = [
   [
  { name: "House of cards", rating: 9.1, users: 204420 },
  { name: "Breaking Bad", rating: 9.5, users: 664927 }
],
   [
  { name: "Once Upon a Time in Wonderland", rating: 7.1, users: 8705 },
  { name: "Once upon a time", rating: 8.1, users: 139421 }
  ]
];
Array.prototype.concatAll = function() {
  var results = [];
  
  this.forEach(function(subArray) {
    subArray.forEach(function(item) {
      results.push(item);    
    });
  });  
  return results;
};
var shows =  IMDBShows.concatAll();
    
shows.forEach(function(show) {       
  console.log(JSON.stringify(show));  
});
// [ [1], [2, 3], [], [4] ].concatAll()
// [1,2,3,4]
Output

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

Dismiss x
public
Bin info
amitjain1307pro
0viewers