|
Helping ordinary people create extraordinary websites! |
Higher Order Programming in JavaScriptBy Sjoerd Visscher2006-08-18
When should you use this? ModularisationWhen you have 2 (or several) functions that are almost the same except for a small part of the code, then you should consider to combine these functions into one. Replace the part that is different with a function call to a separate function. This function is passed to the new more general function as an argument. Something differentWhen you've grown bored of writing for-loops (like I did), methods like Tutorial Pages: » Introduction » Generating HTML » Using methods as functions » When should you use this? This article is licensed under the Creative Commons |
|