> ## Documentation Index
> Fetch the complete documentation index at: https://blog.sumathi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

#  Practice Set 6

* Write a program using prompt function to take inut of age as a value from the user and use alert to tell him if he can drive
* In Q1 add a confirm to run again and again
* In Q2 use console.error if age is negative
* If user is over 20 redirect him to bike website
* Change the colour of page using prompt

```js theme={null}

// Problem No 1
let age = Number.parseInt(prompt("What is your age ?"));
alert("You " + (age < 18 ? "cannot" : "can") + " drive");

// Problem No 2
let askPrompt = true
let enterAge;
while (askPrompt) {
    askPrompt = false;
    enterAge = Number.parseInt(prompt("What is your age ?"));
    if (enterAge < 0) {console.error("Please enter a valid age"); break;} // Problem No 3
    alert("You " + (enterAge < 18 ? "cannot" : "can") + " drive");
    askPrompt = confirm("Do you want to check again ?")
}

// Problem No 4
if (enterAge > 20) {
    location.href = "https://www.royalenfield.com/in/en/motorcycles/" ; // No back button when using this
}
 
// Problem No 5
let col = prompt("enter a colour");
document.body.style.background = col;




```
