Pages

Tuesday, June 21, 2016

Coding challenge that can be solved with Underscore functions

Take a bunch of objects, with a bunch of products as properties and dollar amounts as values, and build one brand new object that contains all products over 5 dollars from each object.


You can use the below objects as examples:


var objCandy = {
"candy bar" : 1.5,
"bag of chocolate" : 3,
"big bag of marshmallows" : 6,
"Ferrorro Rocher - 20 pk " : 9,
chocolate_syrup : 3
};

var objProduce = {
"head of lettuce - organic" : 3,
"bag of organic apples" : 10,
lemon : 1,
"10 pound bag of potatoes": 7,
Broccoli : 4,
cherries : 12,
};

var objMeat = {
beef : 8,
chicken : 5,
pork : 6,
hotdogs : 4,
salmon : 16
};

var objDry = {
bread : 3,
peanutButter : 6,
jelly : 3,
coffee : 10,
tea : 4,
jalapenos : 4
};

var objFrozen = {
"ice cream" : 4,
vegetables : 6,
pizza : 12,
waffles : 6,
juice : 3,
"fish sticks" : 8
};

var dairy = {
cheese : 13,
creamCheese : 4,
butter : 7,
eggs: 5,
milk : 6
};

var toys = {
PS4 : 350,
"Xbox One" : 320,
videoGame : 40,
bike : 90,
lego : 180
};












No comments:

Post a Comment