0

[Solved] Why the 'trip planner' and the 'snail in the well' examples had the same line of code at the beginning?

Hello, can someone explain to me why they had the line: parseInt(readLine(), 10); at the beginning? What does that line, and why both had the value of 10. I haven't seen that yet in JavaScript.

2nd Jan 2021, 8:02 PM
Johanna
Johanna - avatar
5 ответов
+ 2
Johanna here in the example the variable distance is getting a value for you. This part of code stay without changes. Your code will be tested with a few different numbers and then the result compared with a result of original code of Sololearn. You should write a solution for a requested task. This is solution‘s example: function main() { var distance = parseInt(readLine(), 10); //your code goes here console.log(60*distance/40) }
2nd Jan 2021, 10:13 PM
JaScript
JaScript - avatar
+ 2
Thanks! I didn't want to keep trying the other exercises without this info because I am not seeing parseInt yet in my course.
2nd Jan 2021, 11:34 PM
Johanna
Johanna - avatar
0
This data input for automatically test of a code. This will help you to understand it: https://code.sololearn.com/WLqa7iV6A1uK/?ref=app
2nd Jan 2021, 8:18 PM
JaScript
JaScript - avatar
0
At the beginning they give user input as themselves will propose their test cases and you have to complete the code based in their input.
2nd Jan 2021, 8:21 PM
HBhZ_C
HBhZ_C - avatar
0
That code has a value stored in some place or 'reads' the text in the example?
2nd Jan 2021, 8:27 PM
Johanna
Johanna - avatar