Skip to content

Instantly share code, notes, and snippets.

@doritostains
Last active February 21, 2019 01:34
Show Gist options
  • Select an option

  • Save doritostains/16ce136393350e4a883c3404936f85d3 to your computer and use it in GitHub Desktop.

Select an option

Save doritostains/16ce136393350e4a883c3404936f85d3 to your computer and use it in GitHub Desktop.
// 2. Given the following wheels and categories. Write a function named “wheelsWithCategories”
// that produces the result below.
const wheels = {
wheels: [
{
wheelID: 1,
wheelCategory: 'OffRoad'
wheelName: 'OffRoad One'
},
{
wheelID: 2,
wheelCategory: 'Performance',
wheelName: 'Performance two'
}
]
};
const categories = {
categories: [
{
name: 'OffRoad',
Description: 'Off-Road'
},
{
name: 'Performance',
Description: 'Performance wheels'
},
]
};
// Output
console.log(wheelsWithCategories(wheels, categories));
=> {
wheelsWithCategories: [
{
wheelID: 1,
wheelCategory: 'OffRoad',
wheelName: 'OffRoad One',
categoryInfo:
{
name: 'OffRoad',
Description: 'Off-Road'
}
},
{
wheelID: 2,
wheelCategory: 'Performance',
wheelName: 'Performance two',
categoryInfo:
{
name: 'Performance',
Description: 'Performance wheels'
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment