+ 1
How to take user input in JS?
Ok so I was learning with the sololearn "Introduction to JavaScript" course. Unlike other coding language courses I completed they never taught me how to take user input ( yes i know stuff like <textarea> and <input> in HTML but i want the input method in JS ) In the practice thingys that are at the end of every lesson i sometimes see that they use "let variable = readLine();" to take input but when i try it on the code playground it says that readLine wasn't defined. So what? Is there a system to take input through a popup just like C++ and python? And what about the readLine()? And how can i use them?
4 Respostas
+ 4
Have you tried using the search bar or doing a simple google search for the syntax?
+ 3
Justice no, now i found the answer... i really forgot google was a thing 💀
So it is something like " let variable = prompt('hello world'); "
Yasin Rahnaward Thanks for letting me know what's up with the readLine().
+ 1
It is easy.
If you want to use the user input in the same site watch this video,
https://www.youtube.com/watch?v=KB6Yg5hNrqc&ab_channel=KeithPaterson
You will pretty much get the idea.
If you want to send input to other files you would need to learn how modules in JS work. For that have a look at this,
https://www.w3schools.com/js/js_modules.asp