O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

Writing code to process and check passengers

Now typically you’d write a function for each of these conditions: one to check the no-fly-list, one to check that every passenger has paid, and one to print out all the passengers. But if we wrote that code and stepped back to look at it, we’d find that all these functions look roughly the same, like this:

image with no caption


Cover of Head First JavaScript Programming


A good example of functions as first class values