0

What is an analogy used to explain callback in javascript to a layman person? I am a 13 year old coder trying to explain anonymous functions to people without knowledge of coding how can I explain callback functions without using any technical terms.

2
  • 1
    Notice that callback doesn't necessarily mean an anonymous function expression. You can first declare a function and then pass it by name as well - that might help for people who aren't too familiar with the syntax. Commented Apr 3, 2014 at 19:13
  • an alarm clock is a callback from sleeping when the condition of needing to go to work is fulfilled. Commented Apr 3, 2014 at 19:38

1 Answer 1

1
  • You go to a library to borrow a book.

  • They don't have the book since someone already took it.

  • Instead of waiting for the book for 4 days there, you go home. When they have the book - they call you back.

That's a callback.

Sign up to request clarification or add additional context in comments.

2 Comments

Isn't it more like giving the library people a sheet of paper where you've noted what to do when the book arrives? You might write "give me a call" or "send book per post" or whatever…
The library is the one managing it, you're only telling them to call you back, they can have a sheet or whatever alternative they want :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.