+ 1
What is wrong with my JavaScript code?
function lifeInWeeks(age) { /************Don't change the code above************/ console.log(age*52); /*************Don't change the code below**********/ } function lifeindays(age){ console.log(age*365); } function lifeinmonths(age){ console.log(age*12); } console.log("you have "+lifeindays+"days, "+lifeInWeeks+ "weeks, and "+ lifeinmonths + "months left");
3 Answers
+ 1
A͢J anyway not working
+ 1
Laziza Khasanova
Yes because you didn't return value inside function and you just call function without any argument. So you should return value and call function with an argument like this:
//What is wrong with my JavaScript code?
function lifeInWeeks(age) {
/************Don't change the code above************/
return age * 52;
/*************Don't change the code below**********/
}
function lifeindays(age){
return age * 365;
}
function lifeinmonths(age){
return age * 12;
}
var age = 20
console.log("You have " + lifeindays(age) + " days, " + lifeInWeeks(age) + " weeks, and " + lifeinmonths(age) + " months left");
0
Laziza Khasanova
You missed '+' after 'lifeinmonths' in last statement.