0

How do I solve the sololearn Javascript time planner

Question: Trip Planner You need to plan a road trip. You are traveling at an average speed of 40 miles an hour. Given a distance in miles as input (the code to take input is already present), output to the console the time it will take you to cover it in minutes. Sample Input: 150 Sample Output: 225 my code: function main() { var distance = parseInt(readLine(), 10); //your code goes here var x = (distance/40)*60; console.log(x); } main(); but it keeps making the output: NaN NaN pls help

21st Mar 2021, 8:34 PM
DURU SOMTOCHUKWU PHILIP
DURU SOMTOCHUKWU PHILIP - avatar
2 odpowiedzi
+ 4
You don't need to call main() yourself. Sololearn will do that for you. So remove that last line: //main() It's an easy mistake to make. They don't make it very clear. The Sololearn coding environment has some flaws in my opinion. It's inconsistent. Another example of this is that sometimes you're supposed to console.log your answer and other times you're supposed to return it.
21st Mar 2021, 8:46 PM
CamelBeatsSnake
CamelBeatsSnake - avatar
- 1
Return distance / 40 / 60
29th Mar 2021, 1:13 PM
Ivana Zirojević
Ivana Zirojević - avatar