Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

javascript operator code help?

Is there an operator that you can place between 2 sets of numbers that tells the program that the inputed info is anything inbetween or equal to that set of numbers?

I'm supposed to create a script that asks for the student's percentage point through a prompt box and then spits out a letter grade in an alert box. The first one was was easy enough but i have become stuck on the rest.

If anything resulting between a 80 and 89 equals a B, what kind of operator or how would i right that out to get the right responce in an alert window?

If Else Statement:

if (gradePercent >= 90)

{

alert("Your letter grade is an A");

}

else if (gradePercent ________)

{

alert("Your letter grade is a B");

}

4 Answers

Relevance
  • C B
    Lv 4
    1 decade ago
    Favorite Answer

    else if (gradePercent >= 80 && gradePercent < 90)

    {

    alert("Your letter grade is a B");

    }

  • 1 decade ago

    I believe you should be able to use both a less than and greater than with an and to get what you want:

    else if (gradePercent <= 89 && gradePercent >= 80)

    or

    else if ((gradePercent <= 89) && (gradePercent >= 80))

  • Sídhe
    Lv 7
    1 decade ago

    what goes into the blank is ">= 80"

    Unlike the other answers, you don't have to put in "&& gradePercent < 90" because if it was 90 or more, the if statement above it would have gotten it and it would not have fallen to the else.

  • 4 years ago

    provided that y=5, the table under explains the arithmetic operators: + Addition ---------------------------------- x=y+2 x=7 - Subtraction ----------------------------- x=y-2 x=3 * Multiplication --------------------------- x=y*2 x=10 / branch ---------------------------------- x=y/2 x=2.5 % Modulus (branch the rest) ----- x=yp.c.2 x=a million ++ Increment -------------------------------- x=++y x=6 -- Decrement ------------------------------ x=--y x=4

Still have questions? Get your answers by asking now.