Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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