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
// generic reportOrders that shows your orders to the function | |
function reportOrders (minionOrders) { | |
if ( typeof minionOrders === "string"){ | |
console.log(minionOrders); | |
} | |
else if ( typeof minionOrders === "object"){ | |
for (var item in minionOrders) { | |
console.log(item + ": " + minionOrders[item]); | |
} | |
} |
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 packBox(item){ | |
console.log('Put ' +item+ ' in the box'); | |
function addressPackage(address){ | |
console.log('Addressed the box to ' +address+' and ready to send the '+item+' gift'); | |
} | |
return addressPackage; | |
} |
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 packBox(item){ | |
console.log('Put ' +item+ ' in the box'); | |
function addressPackage(address){ | |
console.log('Addressed the box to ' +address+' and ready to send the '+item+' gift'); | |
} | |
return addressPackage; | |
} |
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
let box1= ["juice", "sandwich", "chips", "yogurt"]; | |
let box2 = ["milk", "sandwich", "carrots", "chips"]; | |
let total = box1.concat(box2); | |
let answer = total.filter(function(item){ |
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
let box1= ["juice", "sandwich", "chips", "yogurt"]; | |
let box2 = ["milk", "sandwich", "carrots", "chips"]; | |
let total = box1.concat(box2); |
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
let box1= ["juice", "sandwich", "chips", "yogurt"]; | |
let box2 = ["milk", "sandwich", "carrots", "chips"]; | |
let total = box1.concat(box2); | |
let answer = total.filter(function(item){ |
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
let box1= ["juice", "sandwich", "chips", "yogurt"]; | |
let box2 = ["milk", "sandwich", "carrots", "chips"]; | |
let total = box1.concat(box2); | |
let answer = total.filter(function(item)({ |
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
cookout.grill.apply(cookout, this.mealOrders); | |
// "I am going to cook: chicken, burger, burger, steak, chicken |
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
let cookout = { | |
mealOrders: ["chicken", "burger", "burger", "steak", "chicken"], | |
grill: function() { | |
let args = Array.prototype.slice.call (arguments); | |
console.log("I am going to cook :" + args.join(",")); | |
} | |
} |
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
cookout.grill("steak"); | |
// "I am going to fire up the grill to cook steak with soda to drink!" | |
cookout.grill.call(fancyDinner, "steak"); | |
// "I am going to fire up the grill to cook steak with wine to drink!" |
NewerOlder