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
6 Réponses
+ 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.
0
Oh thanks a lot
0
I was even doing console.log( main())
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.
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).
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.