Posts

Showing posts from November 19, 2018

Extracting data in ES6

Image
up vote 2 down vote favorite I have this array const idArray = ["12", "231", "73", "4"] and an object const blueprints = { 12: {color: red, views: [{name: "front}, {name: "back}, {name: "top}, {name: "bottom}]}, 231: {color: white, views: [{name: "front}, {name: "back}]}, 73: {color: black, views: [{name: "front}, {name: "back}, {name: "top}, {name: "bottom}]}, 4: {color: silver, views: [{name: "front}, {name: "back}, {name: "top}, {name: "bottom}]}, } How can I return an array of the following objects that have all front, back, top, and bottom using ES6 map/filter/some and etc?: result =[ {colorId: "12", views: [{name: "front}, {name: "back}, {name: "top}, {name: "bott