What exactly are you expecting this:
userAnswer = userArray++;
To do? ++ is an integer operation to increment a number. It has NOTHING to do with arrays whatsoever! You could use it to increment the index into an array, but that would be a separate variable.
I THINK what you are trying to do should be:
userArray.push(userAnswer);
which puts the value onto the end of the array as a new record.
Also, this:
if (userAnswer > 0){
myFunction();
userAnswer = userArray++;
}
else {
if (userAnswer > 0) {
That second if makes no sense, you already tested for zero... it would never fire as an ELSE. Take out the code in the middle and you can see how silly it is...
if (userAnswer > 0){
} else {
if (userAnswer > 0) {
See?
Also, if you're just going to run it, instead of making "myfunction" use an anonymous function instead. Also, you don't have anything in there to actually make things loop to keep asking. Also, document.write of an array 'blind' like that is probably going to look pretty ugly, you'd want to at least throw some line-breaks in there by iterating through the array.
(function() {
var results = [], answer, i;
while ((answer = prompt('Geef een getal in!')) > 0) results.push(answer);
for (i = 0; i < results.length; i++) document.write(results[i] + '<br />');
})();
Is probably more along the lines of what you are trying to do.