I am trying to write a simple program in Javascript which will take 10 inputs from user and stored in an array and then display the input in console.
Below the code which I have already write:
var name = [];
for(var i =0; i<=10; i++){
name[i]=(prompt('Enter your name'));
}
console.log(name);
But it is not showing any values and I have tried to console values of i inside the for loop.
It is showing undefined in console. Please help me to solve this issue. Thanks.