+ 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");

10th Apr 2022, 10:00 AM
Laziza IOS
Laziza IOS - avatar
3 Answers
+ 1
A͢J anyway not working
10th Apr 2022, 10:18 AM
Laziza IOS
Laziza IOS - avatar
+ 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");
10th Apr 2022, 10:22 AM
A͢J
A͢J - avatar
0
Laziza Khasanova You missed '+' after 'lifeinmonths' in last statement.
10th Apr 2022, 10:17 AM
A͢J
A͢J - avatar