Advertisement
anatolt

codeacademy bug

Feb 2nd, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Define the function under this line
  2. var canIDrive = function(myAge, legalDrivingAge){
  3.     if(myAge >= legalDrivingAge){
  4.         return true;
  5.     } else {
  6.         return false;
  7.     }
  8. };
  9.  
  10. // Declare legalDrivingAge under myAge
  11. var myAge = prompt("How old are you?");
  12. var legalDrivingAge = 18;
  13. //Create an if else statement using the function as a condition
  14. if (canIDrive(myAge)) {
  15.   console.log("You can legally drive!");
  16. }
  17. else {
  18.   console.log("You'll have to wait a few more years!");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement