I am trying to implement a functionality which ask several qs to store them return funny sentence with those inputs. But it's not working, there are no errors shown, but list not saving the 3 inputs from the user itself, and noticed that each time it saves the input in alist array..it replaces the previous list item,,but I want to save all of the three.
for(i = 0; i < 3; i++) {
var qlist = ["adjective?","Verb?", "noun?"];
var alist = [];
alist[i] = prompt(qlist[i] + "[questions number-" + i + "]");
}
var statement = document.write("There once was a "+ alist[0] + " programmer who once wanted to use javascript to " + alist[1] + " the " + alist[2]);
alert(statement);