Problem 27. Write a program using prompt function to take input of age as a value from the user and use alert to tell him whether he can drive! Use confirm to ask the user if he wants to see prompt again. Use console.error to log error if the age entered is negative.
constcanDrive=(age)=>{return age>=18?true:false;}let age =prompt(`Enter age`);
age = Number.parseInt(age);if(age <0)
console.error('age is negative');elseif(canDrive(age))alert(`hey buddy! you can drive`);elsealert(`you cannot drive`);