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.
Trending News
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
- C BLv 41 decade agoFavorite Answer
else if (gradePercent >= 80 && gradePercent < 90)
{
alert("Your letter grade is a B");
}
- Bryan ALv 51 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ídheLv 71 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.
- gucciardoLv 44 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