Hello, I have a question about working with arrays. I did search for answers before posting this but couldn't find a solution.
My goal is to create a simple code where a prompt asks for names until no name is entered. However, when I try to access the array at the end, it only shows 'true' instead of the actual names.
I am new to working with arrays and have tried various methods without success in getting the correct names. Can anyone provide some guidance on this issue?
var enterNames = new Array();
var i;
while(i = prompt("Please enter a name", "") != "")
{
enterNames.push(i);
}
document.write(enterNames);
Thank you in advance for any help you can offer.
Best regards, Jack