Practice Set in JavaScript
//Question 1 : Write a program using prompt function to take input of age as a value from the user and // use alert to tell him if he can drive! /*let runAgain = true; const canDrive = (age) => { return age >= 18 ? true : false; } while (runAgain) { let age = prompt("Enter your age : "); age = Number.parseInt(age); if (canDrive(age)) { alert("Yes you can drive"); } else { alert("You can not drive"); } runAgain = confirm("Do you want to play again ?"); }*/ //Question 2 : In Question 1, use confirm to ask the user if he wants to see the prompt again //Solution of Question 2 is shown in above code. //Question 3 : In the previous question, use console.error to log the error if the age entered is negative. /*let runAgain = true; const canDrive = (age) => { return age >= 18 ? true : false; } whi...