Created
November 8, 2016 10:26
-
-
Save chisumo2016/c2919ca27278c37149c586948a10135e to your computer and use it in GitHub Desktop.
JavaScript boilerplate
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<p>Click the button to list all the items in the array.</p> | |
<button onclick="numbers.forEach(myFunction)">Try it</button> | |
<p id="demo"></p> | |
<script> | |
demoP = document.getElementById("demo"); | |
var numbers = [4, 9, 16, 25]; | |
function myFunction(item, index) { | |
demoP.innerHTML = demoP.innerHTML + "index[" + index + "]: " + item + "<br />"; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment