Created
May 8, 2017 01:32
-
-
Save kolya182/ca222a3b99e737aa3808c0182d792c7d 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
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