How do I solve the sololearn Javascript time planner | Sololearn: Learn to code for FREE!


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

3/21/2021 8:34:07 PM


2 Answers

New Answer


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.


Return distance / 40 / 60