Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed a function
  • Loading branch information
slc12001 committed Feb 7, 2016
1 parent 470be60 commit bdb27be
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions js/main.js
@@ -1,14 +1,14 @@
/**
*
* 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.
*
**/
var logVar = document.querySelector("#log");
function fancyLog(text) {
console.log(text);
console.log(text);
logVar.innerHTML +="<p>"+text+"</p>"
// Now what goes in here?
}
Expand All @@ -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 + ".")
}

/**
Expand All @@ -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));


/**
Expand All @@ -63,13 +64,14 @@ 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
* variable here. Use fancyLog() to display/log "5 kilometers is equal to {miles} miles."
*/

var distance = kilometersToMiles(5);
console.log(distance);

fancyLog("5 kilometers is equal to " + distance + " miles.");
console.log(distance);

0 comments on commit bdb27be

Please sign in to comment.