Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4.What will be displayed in the user\'s browser after the following code execute

ID: 3724446 • Letter: 4

Question

4.What will be displayed in the user's browser after the following code executes if the user enters 87 at the prompt?

"use strict"

var getInfo = function() {

grade = parseInt(prompt("What's your score on the test?"));

var newGrade = getResult(grade);

alert("Your grade, curved, is " + newGrade);

};

var getResult = function(grade) {

var newGrade = grade + 5;

return (newGrade);

};

a.an alert will display: Your grade, curved, is 92

b.an alert will display: Your grade, curved, is NaN

c.nothing will display; grade is an undeclared variable

d.nothing will display; newGrade cannot be declared twice

Explanation / Answer

"use strict" is before function definition which changes the bad syntax to errors.  

Here grade is not declared so nothing will be displayed in the browser.

If the code is like below

"use strict"

var getInfo = function() {

var grade = parseInt(prompt("What's your score on the test?"));

var newGrade = getResult(grade);

alert("Your grade, curved, is " + newGrade);

};

var getResult = function(grade) {

var newGrade = grade + 5;

return (newGrade);

};

The output will be "Your grade, curved, is 92"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote