diff --git a/js/main.js b/js/main.js index 42b9c14..2e6417f 100755 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,6 @@ /** * -* Write a function that will simultaneously perform a console.log() +* Write a function that will simultaneously perform a console.log() * and write a new paragraph to the #log div with whatever text you give it. * You are just creating the function, NOT calling it yet. Here, I'll get you started. * @@ -8,7 +8,7 @@ **/ var logVar = document.querySelector("#log"); function fancyLog(text) { - console.log(text); + console.log(text); logVar.innerHTML +="

"+text+"

" // Now what goes in here? } @@ -20,11 +20,11 @@ function fancyLog(text) { */ function calculateAges(currentyear,birthyear) { - var age1 = currentyear-birthyear; + var age1 = currentyear-birthyear; // Calculate age2 properly. var age2 = age1 - 1; // Now call fancyLog() with the text "If you were born in {birthYear}, your age could be {age1} or {age1}." - fancyLog("If you were born in " + birthyear + ", your age could be " + age1 + " or " + age2 + ".") +fancyLog("If you were born in " + birthyear + ", your age could be " + age1 + " or " + age2 + ".") } /** @@ -37,12 +37,13 @@ function calculateAges(currentyear,birthyear) { function kilometersToMiles(kilo){ // Do the converstion here and set a variable "miles" - var miles= kilo*0.621371; + var miles= kilo*0.621371; console.log(miles); + console.log(kilo); return miles; -} -kilometersToMiles(8); +} +console.log(kilometersToMiles(10)); /** @@ -63,7 +64,6 @@ var currentyear = day.getFullYear(); var birthyear = prompt("What is your birthyear"); calculateAges(currentyear,birthyear); -fancyLog("If you were born in" + birthyear + ", your age could be" + age1 + "or" + age2); /** * Call your kilometersToMiles() function to convert 5K to miles. Store the returned value in a @@ -71,5 +71,7 @@ fancyLog("If you were born in" + birthyear + ", your age could be" + age1 + "or" */ var distance = kilometersToMiles(5); +console.log(distance); + fancyLog("5 kilometers is equal to " + distance + " miles."); console.log(distance); \ No newline at end of file