+ 1

How to accept user input when working with JavaScript??

When I try to solve JavaScript solution in Sololearn I don't understand how to accept user input. So how can I get it?

16th Sep 2021, 8:13 AM
😍😀🙏
😍😀🙏 - avatar
12 Respuestas
+ 3
Amansisa Tadese I have also struggled with this problem, so have 2 suggestions for you When trying to resolve a challenge in Playground, I replace the input with a pre-written example for the code to test var example = readline() // replace var example = "test this instead" If you wish, you could also play with this snippet written by Vasiliy https://code.sololearn.com/cdCpP5P11Ykj/?ref=app Abhay Could you elaborate further regarding prompt() as it did not work for me when I tested.
16th Sep 2021, 9:16 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Thanks Abhay and Rik Wittkopp I get some points:👍👍
16th Sep 2021, 10:56 AM
😍😀🙏
😍😀🙏 - avatar
+ 2
Abhay I get confused by it also Constantly 🤣😂
16th Sep 2021, 9:46 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
prompt('Your-Text-Here') Is The Only Method to Receive input in Web JS...
16th Sep 2021, 1:15 PM
Sancho Godinho
Sancho Godinho - avatar
16th Sep 2021, 2:08 PM
😍😀🙏
😍😀🙏 - avatar
+ 1
prompt() . You can use input element as well.
16th Sep 2021, 8:15 AM
Abhay
Abhay - avatar
+ 1
Abhay I thought they were the same because I have only ever completed Javascript, yet am getting invites to assist with node js.
16th Sep 2021, 9:38 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Rik Wittkopp op is asking about input in javascript but now i re read the question , it seems like they are talking about node js !
16th Sep 2021, 9:41 AM
Abhay
Abhay - avatar
+ 1
Amansisa Tadese Welcome 😊. Also, Are You Amansisa Tandese Gudina?
16th Sep 2021, 5:57 PM
Sancho Godinho
Sancho Godinho - avatar
+ 1
Sancho Godinho [DM Free] Yes. I left that account since I lost my email...
16th Sep 2021, 6:58 PM
😍😀🙏
😍😀🙏 - avatar
0
function main() { let name = readLine(); userName(name); } function userName(name){ //complete the function //use backtick (` `) for template literal let msg = `Welcome, ${name}!`; console.log(msg); }
7th Jan 2023, 1:21 PM
zrar
- 1
Rik Wittkopp node js or javascript ?
16th Sep 2021, 9:32 AM
Abhay
Abhay - avatar