Now it's time to called our project and get some grades to our students.
What I'm going to do right now is from A to F, I'm going to build the F statements from higher number
to lower number.
There are so many ways you can solve these F analysis statements and get to the same result.
I believe this is the easiest one, but.
It's not the only one.
There are many other ways.
So let's go for my way of solving this first thing to make our application a little bit more interesting,
I'm going to ask the user to enter the grade from 0 to 100, so the first variable will be great and
this variable will have a question.
So there is a prompt over here, and this prompt will have a question.
Please enter your grade.
I can also give an example between 0 to 100, and I think that's all.
0 to 100.
Yeah.
Please enter your grades.
0 to 100.
Okay, let's check if this is working console.log and then.
Great save.
The prompt should be here.
Please enter your grade 100 return.
Yes, I have the number.
100 returning to the console.
Great.
Next part.
Let me just erase this.
Let's start our F analysis statement from the top to the bottom, from the 100.
So if the grade is greater or equal than 90, greater or equal than 90, what should I return?
I should return.
Let me see.
Your grade is a OC, so I should return console.log and your GRE.
Right.
Is a.
Period.
Och yeah.
So that's the one.
The next one.
Yeah.
I should try it on the console.
I can also return as a, as an alert, as a response to the prompt.
I think I'm going to do that.
We did a lot of consoles.
Alert.
Is a function that returns as a pop up message to the actual page.
I think it will be more more interesting like this.
The second one.
The second part is a L else F Yeah.
So the second one is the ls F and the ls F will be something like this.
LS f What is the condition?
If the grade is greater or equal to 80, I can leave some spaces in here.
Or I can do without spaces.
That's no problem.
We're going to set an alert to say your grade is be great.
Let's do the same thing for C.
If your grade is greater than 70.
Your grade is C.
And.
The last one.
Let's go for the RD.
I think these 60.
Let me just double check.
He is 60.
60.
DX.
And anything below 60 should be F.
So the last one, the last one, I'm not going to even mention the 60 because anything greater or equal
than 60 that means anything below 60 falls to the last one.
So the last one is just a simple ls.
And inside of this LS.
Just an alert because this is the last statement.
Your grade is f, c d a, I'm missing something here.
Let me see what I'm missing.
No, I'm not missing A, B, C, d, and f.
I thought I was missing the E.
I'm not missing anything.
There we go.
So your grade is F.
Let's save this and see if it's working.
What is your grade?
So I'm an excellent student.
My grade is 95.
95.
Your grade is a.
It works.
Let's refresh the page.
My grades.
I'm not very good.
40 your greatest f.
Let's go in between.
Let's try to reach the the c anything from 70 to 79.
So my grade is 75.
It should be C That's it.
So this is our code.
As I said, there are so many ways to achieve this one, and there are a few problems over here as well.
I.
I didn't set any kind of a.
Error treatment or if somebody just entered the number 200, they will get the grade A, But I want
anything from 0 to 100.
There are ways we can improve this code.
It's not going to be right now, but just keep that in mind.
There are some problems over here, but at least it's returning.
When somebody enters the right number, it is returning the right grade.