0

How the fuction take a input? in python is input() or int(input()) but in JavaScript? no is there?

function main() { var distance = parseInt(readline(), 10) var distance_dv = distance/40 var result = distance_dv*60 console.log(result); }

30th Aug 2022, 7:19 PM
Josué Varela
Josué Varela - avatar
4 Respostas
+ 3
You can use the HTML element called 'input' to write or get values, or the javascript "prompt()"
30th Aug 2022, 7:53 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 3
readLine() which is in first line of your function is the input method of SoloLearn Node.js type code practice.
30th Aug 2022, 8:30 PM
Gordon
Gordon - avatar
+ 2
Thanks all for your support, I want to live of this xd, thanks ❤️❤️❤️
31st Aug 2022, 7:09 PM
Josué Varela
Josué Varela - avatar
+ 1
It depend javascript is web language and you can take user input in few ways, mostly we use some input field in html, and read inputed data with js. You can also use prompt() with this user will get pop up window to enter value, this is not good practice in websites, to have lot of this things, users will mostly leave from site. Code you posted use readline() to insert testing value in code. This is from node.js, so this command wont work in regular javascript. You can ignore this one and only remmember what it does.
30th Aug 2022, 8:00 PM
PanicS
PanicS - avatar