file: exercise5.zip
// Make a keyless car EVEN BETTER!
// We are improving our car from previous exercise now.
// Solutions to future exercises will be in the .js file (meaning Javascript file) from now on.
var age = prompt("What is your age?");
if (Number(age) < 18) {
alert("Sorry, you are too yound to drive this car. Powering off");
} else if (Number(age) > 18) {
alert("Powering On. Enjoy the ride!");
} else if (Number(age) === 18) {
alert("Congratulations on your first year of driving. Enjoy the ride!");
}
//1. Make the above code have a function called checkDriverAge(). Whenever you call this function, you will get prompted for age. Use Function Declaration to create this function.
// Notice the benefit in having checkDriverAge() instead of copying and pasting the function everytime?
//2. Create another function that does the same thing, called checkDriverAge2() using Function Expression.
//BONUS: Instead of using the prompt. Now, only use console.log and make the checkDriverAge() function accept an argument of age, so that if you enter:
checkDriverAge(92);
it returns "Powering On. Enjoy the ride!"
.
my answer
function checkDriverAge(){
age=prompt("What is your age?");
if (Number(age) < 18) {
return "Sorry, you are too young to drive this car. Powering off";
} else if (Number(age) > 18) {
return "Powering On. Enjoy the ride!";
} else if (Number(age) === 18) {
return "Congratulations on your first year of driving. Enjoy the ride!";
}
}
The tablet market is booming, with more and more people turning to tablets for their computing needs. If you’re in the market for a tablet, you may be wondering what to look for and what’s the best option for you. https://workusingtablets.com/best-tablet-for-writing/
To make a keyless car even better, consider upgrading with advanced security features and convenience options. Enhance your vehicle's safety with GPS tracking systems and remote locking capabilities, ensuring peace of mind. Explore smart connectivity solutions that integrate seamlessly with your lifestyle, allowing for remote start and climate control adjustments via mobile apps. Visit DealinDoug Autos to discover a range of enhancements that elevate your driving experience to new heights. Learn more at https://www.dealindougautos.com for cutting-edge automotive technologies tailored to modern needs.
Upgrading a keyless car offers convenience, but you can enhance it even further by integrating advanced technologies and high-quality aftermarket accessories. Start with adding custom electronics or enhanced security systems, improving both safety and usability. For off-road enthusiasts, outfitting your vehicle with sxs parts can boost performance and durability on rugged terrains. Whether it's upgrading tires, installing premium lighting systems, or fine-tuning engine performance, making these modifications ensures that your keyless car meets both urban and outdoor adventure needs. These enhancements make your driving experience smoother and more efficient.
Melbourne Autos is making waves in automotive innovation by enhancing the features of keyless cars, making them even more convenient and secure. With advanced upgrades like smartphone-based unlocking, driver recognition, and personalized settings, your car experience becomes seamless and tailored to you. Melbourne Autos is also prioritizing safety, implementing encrypted technology to prevent unauthorized access and enhance security. Imagine unlocking, starting, and controlling your car right from your phone! Melbourne Autos is redefining the future of driving by making keyless vehicles smarter, more efficient, and even more enjoyable to use.
Keyless cars offer convenience and ease of use, but there are ways to make them even better. One option is to add a remote start feature, which allows you to start the car and adjust the temperature before getting in. Here you can get carfax and learn more things about cars. You can also install a GPS tracking device, which can help locate your car if it is stolen. Another option is to install a backup camera or parking sensors to improve safety when parking or reversing. Finally, you may want to consider upgrading the sound system for a better listening experience while driving.