Uh-oh, you've been given a nice opportunity to make some money... from the devil! It's quite simple. In a box of 25 drawers, there is a gold coin among them. all you have to do is find the coin, or else you lose your soul! Being a sporting person, the devil has 'graciously' allowed you to use your programming skills to find the gold coin. You have only one chance to open a drawer, so better put those programming skills to use! Map the object Find this object: {name: 'gold coin'} in a 2-dimensional array of objects provided to your function, findGoldCoin.
var drawers = [ [{name: 'one'}, {name: 'two'}, {name: 'three'}, {name: 'four'}], [{name: 'five'}, {name: 'six'}, {name: 'seven'}, {name: 'eight'}], [{name: 'nine'}, {name: 'ten'}, {name: 'eleven'}, {name: 'gold coin'}], [{name: 'thirteen'}, {name: 'fourteen'}, {name: 'fifteen'}, {name: 'sixteen'}] ]; function findGoldCoin(drawers){ for (var i = 0; i < drawers.length; i++) { for (var j = 0; j < drawers[i].length; j++) { if (drawers[i][j].name === 'gold coin') { return {x: i, y: j}; } } } } findGoldCoin(drawers);