What’s wrong with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What’s wrong with this code?

function main() { var distance = parseInt(readLine(), 10); var mph = hours = distance/mph minutes = hours * 60 document.write(minutes) } the code above has something wrong with it. It does not give me an output. Why is that?

28th Feb 2021, 2:58 AM
♥ KimWooBin Lover ♥
♥ KimWooBin Lover ♥ - avatar
3 Answers
+ 5
You missed to define the variable mph as 40. Also you need to get the output in console. So, You have to use console.log instead of document.write
28th Feb 2021, 4:47 AM
Simba
Simba - avatar
+ 2
thank you Simba
28th Feb 2021, 4:49 AM
♥ KimWooBin Lover ♥
♥ KimWooBin Lover ♥ - avatar
- 1
Specify your problem. Please.
28th Feb 2021, 3:24 AM
Daniel Briceño
Daniel Briceño - avatar