Created
May 8, 2017 01:35
-
-
Save kolya182/56779ee089c28342996d9bca589c8c90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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