var str = userInput[0]; var count = 0; while(str[count] !== undefined) { count += 1; } console.log(count)