I made a form to accept input:

HTML Code:
<div>
<form id="formColor" method="POST" action="TestingHTML.html">
<p>Add new color:<br />
<input name="newColorInput" type="text" value="">
<input type="submit" value="GO" onClick="sampleArray()">
</p>
</form>
</div>
I have JS to put the input into an array and show it in the console:

Code:
function sampleArray() {
    "use strict";
// make array
	var colors2 = [];
// obtain new array item from form
	var form = document.getElementById('formColor');
	var newColorInput = formColor.newColorInput.value;
	var newColor = newColorInput;
	colors2.push(newColor);
console.log ("new color = " + newColor);
</script>
Then I added to just above </body>:

Code:
<script>
/* execute the functions */
sampleArray();
</script>
When I enter a word, it merely flashes briefly on the screen and console. How do I code to get the word to remain in the array so it stays on the screen?