Question
In JAVASCRIPT Create an array of 5 Each inner array should contain a name and a numerical grade between 1 and 100 Create a function
In JAVASCRIPT
- Create an array of 5
- Each inner array should contain a name and a numerical grade between 1 and 100
- Create a function called getGrade with a parameter of grade
- Inside the above function, create an if/else statement that accounts for grades and and their respective values from F to A
- Create a for loop that iterates through the length of the students' array and increment by 1 with each loop
- Inside that for loop, use document.write(//your statement); to output a string of text that reads like the following example:
- David's number grade is 80 and letter grade is a B
- this is what I have, but its not working
-
function getGrade(value) {
var david = [80];
var victor = [77];
var tracey = [55];
var jason = [95];
var raymond = [69];
if (value >=100 && value
return 'A.';
} else if (value >=89 && value
return 'B';
} else if (value >=70 && value
return 'C';
} else if (value >=60 && value
return 'D';
} else if (value
return 'F';
}
{
document.write(i + "David's number grade is " + david + " and letter grade is " + [i] + ' ');
document.write(i + "Victor's number grade is " + victor + " and letter grade is " + [i] + ' ');
document.write(i + "Tracey's number grade is " + tracey + " and letter grade is " + [i] + ' ');
document.write(i + "Jason's number grade is " + jason + " and letter grade is " + [i] + ' ');
document.write(i + "Raymond's number grade is " + raymond + " and letter grade is " + [i] + ' ');
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started