We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d50f8cf commit b38fff3Copy full SHA for b38fff3
Chapter 6/Practice Set/29_PracticeSet.js
@@ -1,13 +1,18 @@
1
-let age = prompt("Enter your age:")
2
-age = Number.parseInt(age)
+runAgain = true
3
4
const canDrive = (age) => {
5
return age>=18?true:false
6
}
7
8
-if(canDrive(age)){
9
- alert("You can drive")
10
-}
11
-else{
12
- alert("Sorry! You cannot drive")
+while(runAgain){
+ let age = prompt("Enter your age:")
+ age = Number.parseInt(age)
+
+ if(canDrive(age)){
+ alert("You can drive")
13
+ }
14
+ else{
15
+ alert("Sorry! You cannot drive")
16
17
+ runAgain = confirm("Do you want to see the prompt again?")
18
0 commit comments