Can someone explain this line of code to me? var distance = parseInt(readLine(), 10); | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

Can someone explain this line of code to me? var distance = parseInt(readLine(), 10);

14th Jul 2021, 4:42 AM
Josue Mata
Josue Mata - avatar
3 Respuestas
+ 1
readLine() get input from user as string... parseInt(string, base) convert string to (whole) number using base... so distance expect input entered as base 10 (whole) number ^^
14th Jul 2021, 4:50 AM
visph
visph - avatar
+ 3
Thank you my friend
14th Jul 2021, 5:17 AM
Josue Mata
Josue Mata - avatar
+ 1
var means variable that means distance is a variable taken by you
14th Jul 2021, 5:17 AM
Miss Harshita Singh