Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Kononenko kbk0125

View GitHub Profile
View closurePart1.js
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;
}
View filtercondition2.js
let box1= ["juice", "sandwich", "chips", "yogurt"];
let box2 = ["milk", "sandwich", "carrots", "chips"];
let total = box1.concat(box2);
let answer = total.filter(function(item){
View filtercondition1.js
let box1= ["juice", "sandwich", "chips", "yogurt"];
let box2 = ["milk", "sandwich", "carrots", "chips"];
let total = box1.concat(box2);
let answer = total.filter(function(item){
View FilterExample.js
let box1= ["juice", "sandwich", "chips", "yogurt"];
let box2 = ["milk", "sandwich", "carrots", "chips"];
let total = box1.concat(box2);
let answer = total.filter(function(item)({
View Concatexample.js
let box1= ["juice", "sandwich", "chips", "yogurt"];
let box2 = ["milk", "sandwich", "carrots", "chips"];
let total = box1.concat(box2);
View appcallbind8.js
cookout.grill.apply(cookout, this.mealOrders);
// "I am going to cook: chicken, burger, burger, steak, chicken
View appcallbind7.js
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(","));
}
}
View appcallbind6.js
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!"
View appcallbind5.js
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() {}
View appcallbind4.js
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.