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 drives = [
  {"drivesId": "rwd", "name": "RWD"},
  {"drivesId": "fwd", "name": "FWD"},
  {"drivesId": "awd", "name": "AWD"}
]
var cars = [
  {"carId": "civic", "name": "Civic"},
  {"carId": "wrx", "name": "WRX"},
  {"carId": "mustang", "name": "Mustang"},
  {"carId": "focus", "name": "Focus"},
]
var drivesXcars = [
  {"drivesXcars": "uid1", "carId": "civic", "drivesId": "fwd"},
  {"drivesXcars": "uid2", "carId": "wrx", "drivesId": "awd"},
  {"drivesXcars": "uid3", "carId": "mustang", "drivesId": "rwd"},
  {"drivesXcars": "uid4", "carId": "focus", "drivesId": "fwd"},
]
var carsComplete = drives.map(x=> ({
  drivesId: x.drivesId,
  driveName: x.name,
  cars: drivesXcars
    .filter(n=> n.drivesId === x.drivesId)
    .map(n=> cars.find(m=> m.carId === n.carId))
}))
console.log(carsComplete)
Output

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

Dismiss x
public
Bin info
Gothdopro
0viewers