Help - I need to create alert and then out put number of characters

0 Mike Higgins · June 8, 2014
Hello all!

I have been watching the youtube videos over and over and for some reason I just cannot get it to work!
I need to first create a prompt for the user to enter their name, then output the length of the string. Next, I need to modify the code to display back the characters in uppercase along with the number of characters.


Last I need to modify the html document to get the names of 20 people from the user. I am supposed to store this in an array named "users" then convert to all uppercase. The out put of this final step is suppose to appear something like:
JIM 3
BOZO 4
TOMMY 5

I have thus far been able to create the prompt and the uppercase output, but I can't manage to get the number of characters as an output.

Please assist!

Below is what I have created so far.

<html>
<body>
<script type="text/javascript">
var name=prompt("Please input your first name");
document.write(name.toUpperCase())
document.write(word.length);
document.write(name + str + toUpperCase)
var length = myString.length;
</script>


</body>
</html>

Post a Reply

Replies

Oldest  Newest  Rating
0 Mike Higgins · June 9, 2014
Thank you, for your response.

I am left with 2 more issues


  1. Is there a way to add a space between output name and character count? I tried using the " " in the (name + str + toUpperCase); however this did not work.

  2. How to modify the strings to prompt and output for multiple names and their character count? For example: ROB 3, BECKY 5, LIZ 3, MIKEY 5, .... I want to make this as a list style. Would I include line breaks after each name or prompt?



Thanks for your help.
  • 1

Javascript

107,155 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators