0

How do i produce output

I really need help in that project at the end of the Condition and Loops Module in the Javascript classes

21st Apr 2021, 11:34 AM
Obinna
Obinna - avatar
6 Respuestas
+ 1
I think this is for Snail in the Well. Are you wanting to know how to output? It's just console.log(daysTaken) where daysTaken would be a variable holding your result. If instead you want to know how to solve the problem itself (how to arrive at the result value), please use the search bar. This question has been answered many times.
21st Apr 2021, 11:38 AM
CamelBeatsSnake
CamelBeatsSnake - avatar
0
Oh thanks a lot
21st Apr 2021, 12:15 PM
Obinna
Obinna - avatar
0
I was even doing console.log( main())
21st Apr 2021, 12:15 PM
Obinna
Obinna - avatar
0
Obinna do main function return anything or not? ```js function main() { return 4; } console.log(main()) ; ``` This will give 4. Because main function is returning 4.
21st Apr 2021, 12:49 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
Vivek i get your point. If you use the "return" keyword when defining the function, you will have a value when you call the function later in the program. I even tried to do this but i wasn't getting any results Now i have solved the problem and all i had to do was to output my days count in the function braces. No need for calling the function (which i was doing since).
21st Apr 2021, 12:57 PM
Obinna
Obinna - avatar
0
Obinna It's good to hear you fixed it. Yeah, Sololearn calls the main() function for you in all the exercises. It's not clear in the instructions.
21st Apr 2021, 3:58 PM
CamelBeatsSnake
CamelBeatsSnake - avatar