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); | |
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
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
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!" |
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 = { | |
drink:"soda", | |
grill: function(meal) { | |
console.log("I am going to fire up the grill to cook " + meal + " with " +this.drink +" to drink!"); | |
} | |
} | |
let fancyDinner = { | |
drink: "wine", | |
useOven: function() {} |
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
cookBurger("Jack") | |
// Thanks Jack! Your burger will be ready in 15 minutes. | |
cookSteak("Jill") | |
// Thanks Jill! Your steak will be ready in 10 minutes. | |
cookChicken("David") | |
// Thanks David! Your chicken will be ready in 20 minutes. |
NewerOlder