Created
February 28, 2018 10:28
-
-
Save haingdc/d7420d5aeda4f17587f86c180d178076 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function addColour(colour) { | |
| var rainbowEl = document.getElementById('rainbow'); | |
| var div = document.createElement('div'); | |
| div.style.paddingTop = '10px'; | |
| div.style.backgroundColour = colour; | |
| rainbowEl.appendChild(div); | |
| } | |
| addColour('red'); | |
| addColour('orange'); | |
| addColour('yellow'); | |
| addColour('green'); | |
| addColour('blue'); | |
| addColour('purple'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment