Skip to content

Instantly share code, notes, and snippets.

@kolya182
Created May 8, 2017 01:35
Show Gist options
  • Save kolya182/56779ee089c28342996d9bca589c8c90 to your computer and use it in GitHub Desktop.
Save kolya182/56779ee089c28342996d9bca589c8c90 to your computer and use it in GitHub Desktop.
```javascript
function renderInventory(inventory) {
for (let i = 0; i < inventory.length; i++) {
for (let j = 0; j < inventory[i].shoes.length; j++) {
return `${inventory[i].name}, ${inventory[i].shoes[j].name}, ${inventory[i].shoes[j].price}`;
}
}
}
let currentInventory = [
{
name: 'Brunello Cucinelli',
shoes: [
{name: 'tasselled black low-top lace-up', price: 1000},
{name: 'tasselled green low-top lace-up', price: 1100},
{name: 'plain beige suede moccasin', price: 950},
{name: 'plain olive suede moccasin', price: 1050}
]
},
{
name: 'Gucci',
shoes: [
{name: 'red leather laced sneakers', price: 800},
{name: 'black leather laced sneakers', price: 900}
]
}
];
console.log(renderInventory(currentInventory));
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment