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

2. Modify the Example 19.8 - new program. [20 points] A. Use confirm function to

ID: 3730581 • Letter: 2

Question

2. Modify the Example 19.8 - new program. [20 points]

A. Use confirm function to always ask if the user wants to continue

before the program ends.

B. If the user click OK button, the program should start again.

C. If the user click Cancel button, then the program ends

and output (alert()) "See you next time" message.

Can you also get rid of the number parts so it is just doing what the question asks

<html>

<head>

<title>JavaScript Sort Program</title>

<script language="javascript">

do{

lc = true;

got = prompt ("Would you like to continue");

answer = confirm ("You input: " + got + ". Is this correct?");

if (answer == true){

var ck = isNaN(got);

if (ck == true)

alert(got + " is not a number");

else{

alert ("Your number squared = " + got*got);

}// end if

} // end if

lc = confirm("Do you want to continue?");

// confirm function will promt the user , if user click ok than it will return true if user click canc than it will return false, so here lc will store the return value

// if it is true than it will continue and it is false loop get terminated after coming out of the loop we will print see you next time using alert() function

} while (lc == true)

alert("See you next time");

</script>

</head>

<body>

</body>

</html>

Explanation / Answer

<html>
<head>
<title>JavaScript Sort Program</title>
<script language="javascript">
do{
lc = confirm("Do you want to continue?");
} while (lc == true)
alert("See you next time");
</script>
</head>
<body>
</body>
</html>

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