DEV Community

Cover image for JavaScript’s apply, call, and bind explained by hosting a cookout

JavaScript’s apply, call, and bind explained by hosting a cookout

Kevin Kononenko on April 10, 2018

If you have ever been in charge of operating the grill at a family event or party, then you can understand apply, call and bind in JavaScript. If ...
Collapse
 
sabriele profile image
sabriele • Edited

Hi Kevin! Thanks for the really interesting analogies! I'd just like to point out that your code block for

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!"

doesn't seem to be showing up properly.

Anyway, thanks again for a great article :)

Collapse
 
kbk0125 profile image
Kevin Kononenko

Whoops! Should be fixed :)

Collapse
 
jibinp profile image
Jibin Philipose

An awesome article, thank you for sharing this.

Collapse
 
kbk0125 profile image
Kevin Kononenko

Very welcome Jibin!

Collapse
 
presto412 profile image
Priyansh Jain

While we're on the food topic, check out my pizza with JS article

Collapse
 
kbk0125 profile image
Kevin Kononenko

Wow this is interesting Priyansh! Do you know any Illustrator/graphic design? Some images would make it even better :)

Collapse
 
presto412 profile image
Priyansh Jain

Sadly I don't :(

Thread Thread
 
kbk0125 profile image
Kevin Kononenko

All good! Want to send me an email? Would love to hear where you got the motivation for your post. kevin (at) codeanalogies (dot) com

Collapse
 
desolosubhumus profile image
Desolo Sub Humus 🌎🌍

Ah, food, I love how you explain code.

Collapse
 
peter profile image
Peter Kim Frank

This is great, Kevin! I really appreciate the combination of prose, code snippets, and visual cues. It's a very effective way to describe these concepts. Thanks for sharing!

Collapse
 
kbk0125 profile image
Kevin Kononenko

Thanks Peter :)

Collapse
 
johand profile image
Johan

Excellent! very nice explanation.

Collapse
 
kbk0125 profile image
Kevin Kononenko

Thanks Johan!