JSFiddle - React, Tailwind, and code Playground

Javascript lesson 2

by Ryan Brown

JavaScript

//Javascript quick lesson two If Else & Comparison Operators

//pending on age will decide on alerted response. this scenario, when the user is under the driving age it will state they cannot drive and calculate the amount of wait time they can expect. if the user is of age the alert will prompt them to study and recieve the credentials if the have not done so already. 

//   >    less than 
//   <    greater than
//   >=   greater than or euqal to
//   <=   less than or equal to
//   ==   exactly equal to
//	 !=   is not equal to


//('you can't drive')..bugged closes out
//("you can't drive")..easy fix
//('you can\'t drive')..technical fix \ treats as text

var age = 106;
var waittime = 16 - age;

if(age < 16) {
alert("You cannot drive yet\nPlease wait until you are " + waittime + " year(s) older")
}else if (age == 16) {
alert("you can Finally drive!")
}
else {
alert("You've probable been driving already")
}