Last active
February 21, 2017 00:27
-
-
Save iwilsonq/ae6556099dfdc87070826fb03a209b23 to your computer and use it in GitHub Desktop.
Walking through tutorial: Basic Git and DOM Manipulation
This file contains 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 getRandomNumber(min, max) { | |
return Math.floor(min + (Math.random() * max)); | |
} | |
function createArray(size) { | |
var array = []; | |
for (var i = 0; i < size; i++) { | |
array.push(getRandomNumber(1,100)); | |
} | |
return array; | |
} | |
var array = createArray(100); | |
console.log(array); |
This file contains 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
// | |
// Previous code for getRandomNumber and createArray | |
// | |
function createListElement(number) { | |
var li = document.createElement('li'); | |
li.innerHTML = number; | |
return li; | |
} | |
function appendListElements(array) { | |
var ul = document.getElementById('death'); | |
array.forEach(function(number) { | |
var li = createListElement(number); | |
ul.appendChild(li); | |
}); | |
} | |
appendListElements(array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment