Can anyone help me with this challenge ๐Ÿ˜’

Create a program with if else, through which the variable โ€œpointsโ€ will be compared.
If the points are between 50-60 students have received a grade of 6, if they are between 61-70 students
has received a grade of 7, if they are between 71-80 the student has received a grade of 8, if they are between
81-90 student received a grade of 9, if they are between 91-100 the student received a grade of 10, and if
points are below 50 then the student has not passed the course. The result is displayed with console.log.

Create a ternary operator program that shows whether the student has passed the course or not.
If the points are more than 50 students have passed the course, otherwise not.
The result should be displayed with console.log.

Hi @leonabajrami18 !

What have you tried so far?
Please provide your code so we can help

i didnt try anything cuz i dont know where to start. Im really really out of the system with JS :rofl::cry:

Well, I would suggest doing the first section freeCodeCampโ€™s JS curriculum.

Once you do the 100+ lessons, you will have all of the tools necessary to solve this problem.

From there, break down this challenge into small bite size pieces.

A good place to start would be here

Creating variables doesnโ€™t require a lot of code.

Then you can slowly go through this if else statement.
Start with this first one.

Try it on your own, if you get stuck then come to the forum with your code and we can go from there.

Once you figure out that first one, then it will be easier to tackle the rest of the conditions.

The final part would be to return this ternary operator

that is the roadmap.

Like I said earlier, before you tackle any parts of this challenge, make sure to go through the first part of the fcc javascript curriculum because it will help you alot.

Hope that helps!


Screenshots are hard to read.
Can you write your code in the forum?

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the โ€œpreformatted textโ€ tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (โ€™).

variable = 'points'

if(average>=100 && average<=91)


  document.points ='grade 10';


else if(average>=90 && average<=81)


  document.points ='grade 9';


else if(average>=80 && average<=71)


  document.points ='grade 8';


else if(average>=70 && average<=61)


  document.points ='grade 7';


else if(average>=60 && average<=50)


  document.points ='grade 6';


else if(average<=50)


  document.points ='has not passed the course';



A few things to go over.

This is not how to define a variable.

Please review the lessons in the fcc javascript curriculum on how to do that.

Where is average defined?

The prompt you posted said to use console.log.
But I donโ€™t see that in your code.

I am not sure what document.points is supposed to be here

All of your conditions here would never be true.
For example, this first one.

How can a number be greater than or equal 100 and less than or equal 91?

You will need to fix all of your conditions.

Start with that first condition and get that working before fixing the other ones.

As a general question, are you sure the directions say variable โ€œpointsโ€ will be compared?

If so, do they want you to assign any number to the points value?
Or do they want you to create a function and pass in a number for the argument?

1 Like
type or paste code here
```let points = 100; 
if (points <= 100 && points >= 91){
      console.log("grade 10")

else if(points<= 90 && points >= 81){
      console.log("grade 9")

else if(points <= 80 && points >= 71){
      console.log("grade 8")

else if(points <= 70 && points >= 61){
      console.log("grade 7")

else if(points <= 60 && points >=50 ){
      console.log("grade 6")

else if(points < 50){
    console.log("not passed the test")

That is looking much better.

You still have to tackle the last part here

You can just google ternary operator and how to use it.

But also, it seems like they want you to create a function with your if/else statement inside that returns the ternary result.
I would double check on the instructions.

Or if this is a class, ask your instructor for clarification on the directions.

1 Like

Also, you can probably just do an else clause here

else {
    console.log("not passed the test")
1 Like

Thanks a lottttt for helping . Lot of hugs <33333