Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created February 24, 2018 14:28
Show Gist options
  • Select an option

  • Save haingdc/fc162fd85ddcc4f06a6c6f9843429387 to your computer and use it in GitHub Desktop.

Select an option

Save haingdc/fc162fd85ddcc4f06a6c6f9843429387 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 1
function addMagic(id, effect) {
var element = document.getElementById(id);
element.className += ' magic';
effect(element);
}
addMagic('unicorn', spin);
addMagic('fairy', sparkle);
addMagic('kitten', rainbow);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment