diff --git a/js/assignment.js b/js/assignment.js index 1fc9d3d..a1703dd 100644 --- a/js/assignment.js +++ b/js/assignment.js @@ -5,12 +5,17 @@ const ageInputEl = document.getElementById("age-input") const submissionBtn = document.getElementById("submission-btn"); // create a mutable variable called age and do not assign it a value. - +let age = ""; function checkAgeAndRespond() { age = parseInt(ageInputEl.value); - - // Write your code below + if (age >= 21){ + console.log("You can vote and purchase alcohol."); + } else if (age <21 && age >= 18) { + console.log("You can vote, but you cannot purchase alcohol."); + } else + console.log("You cannot vote and you cannot purchase alcohol."); + } diff --git a/js/index.js b/js/index.js index 1d44ba9..2752dd3 100644 --- a/js/index.js +++ b/js/index.js @@ -1,3 +1,32 @@ // Prevent us from attempting to use variables // that are not declared -"use strict" \ No newline at end of file +"use strict" +let healthPoints = 20; +let experiencePoints = 100; + +if (healthPoints >= 10) { //Checks HP only if >10 then ok + console.log("Hero is healthy."); +} else if (healthPoints < 10 && healthPoints >= 5) { //5 <= hp < 10 + console.log("Hero is slightly damaged."); +} else { + console.log("Hero is close to death."); //if hp <5 then this +} +if (healthPoints >= 20) { + console.log("Hero is leveling up!!!"); //hp >=20 Superhero +} +if (healthPoints == 0) { + console.log("You're hero has died, and you are next!!"); //HP = 0 then dead +} +if (experiencePoints > 100) { //XP allows hero to level up + console.log("Hero has a new Super Power!!"); +} + +if (experiencePoints >= 100) { //XP makes hero a SUPER + console.log("Hero is now a SUPERHERO!!"); +} else if (experiencePoints < 100 && healthPoints >= 5) { //Hero is hungry! + console.log("Hero needs to recharge! Get him a sandwich!!"); +} else if (experiencePoints <100 && healthPoints < 10){ //Hero is dying + console.log("Hero is close to death."); +} else { + console.log("Your Hero Has Died!!"); // Hero is dead +} \ No newline at end of file