Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7593983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:18:25+00:00 2026-05-30T21:18:25+00:00

At the top of my code I need to ask the users if they

  • 0

At the top of my code I need to ask the users if they wish to play a game. Using the string function to look at the first letter of their answer and make it lower case. If their answer == “y” then play the game. I need help taking the first letter of Yes, and making it lower case.

<HTML>
<HEAD>
</HEAD>
<BODY>

<FORM NAME="testform">
<BR>
<BR>
<BR>
</FORM>

<INPUT id="attempts" TYPE="text" NAME="inputbox" VALUE="" />
<INPUT id="zero" TYPE="button" NAME="resetbox" VALUE="Reset " onclick="reset()" />

<SCRIPT type="text/javascript">

varattempts = 0
x = Math.round((Math.random()*19))+1    
var tip

tip=prompt("Do you want to play a game?")

while(tip == "y")

{

    var Guess;
    document.getElementById('attempts').value = 0;
    do {

    Guess = prompt("Pick a number between 1 and 20","")
    if (Guess === null) break;
    document.getElementById('attempts').value = parseInt(document.getElementById('attempts').value)+1
      } while (Guess!=x);

    if (Guess == x)

    {

    alert("You guessed right!")

    }
}

function reset()

{
    varattempts=0;
    document.getElementById('attempts').value = 'Attempts: 0'; 
}

</SCRIPT>
</BODY>
</HTML>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:18:27+00:00Added an answer on May 30, 2026 at 9:18 pm

    To take the first letter of any string, you can use .charAt(0):

    var firstChar = myString.charAt(0);
    

    And to convert it to lowercase:

    var firstChar = myString.charAt(0).toLowerCase();
    

    Voilà!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using this code to ask users for permission for my app $app_id
i need to make my window top level when i need. Code of creating
Anyone have code to set margins(top,left,right,bottom) using excel interop and vb.net. I think it
I am using the following code to position an icon on top of a
I have code in the top layer of my .Net web application that I'd
I've placed below code at the top of the Joomla template but the position
I have the following code in the top frame of a two frame page:
All my controller has this code on the top of class. public class TestController
If you look at the code inside the #top_cat and #high_hat sections below, it's
In the code below, the echo at the top returns true, but the echo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.