Needing help with the following script. I am tasked to return the name.length individually for names entered in the prompt as well as change from lower case to upper case. With the current script it returns a list of names in the number of names not the individual length of each name nor can I get document.write(word.toUpperCase(); to work. Script below:

<p>Enter 20 names</p>
names = new Array();
i = 0;
do {
next = window.prompt("Enter the Next Name", "");
if (next > " ") names[i] = next;
i = i + 1;
while (next > " ");
document.write("<h2>" + (names.length) + " names entered.</h2>");
for (i in names) {
document.write("<li>" + names[i] + "<br>");