Hi everyone,
I'm only a beginner in javascript, and this is a very easy thing to do yet I can't figure it out myself..

As long as the user gives a positive number, we ask the user to give another number untill they give a negative number.
As long as the user gives a positive number, this data should be stored into an array untill the user gives a negative number. When the user gives in a negative number, the stored data should be print out.

Everything works but I can't print out the stored data from the array..

This is my code so far:

<!-- Schrijf een functie die naar een getal blijft vragen zolang het opgegeven getal positief is.
Tel de rij positieve getallen op als een negatief getal wordt opgegeven. -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>oefening2</title>
</head>
<body>
<script type="text/javascript">

function myFunction () {

var userAnswer = prompt("Geef een getal in!")
var userArray = new Array();

if (userAnswer > 0){
myFunction();
userAnswer = userArray++;
}

else {
if (userAnswer > 0) {
myFunction();
userAnswer = userArray++;
}

else {
document.write(userArray);
}
}
}

myFunction();
</script>
</body>
</html>