Friction with input in JavaScript

See? Javascript can do everything (except take input which is still annoying)

2 Likes

There’s prompt() for that, but its ugly and you can just click cancel.

Except reading and writing to files :confused: (Maybe NodeJS can do it but I wish vanilla JS could)

3 Likes

Vanilla JS can!

2 Likes

Bit misleading, vanilla JS, sorta can lol

5 Likes

You mean in Node? Because imo it’s not that hard to just import readline-sync and then do readline.question (or even import readline.question as input to make it simpler).

2 Likes

Yeah I wish we had more customizable alert/prompt/confirm

I know that titles would be used by scammers but it would be great.

2 Likes

yeah but in python you don’t have to import input but in nodejs you have to do stuff

you could use html and use a text thing but that doesn’t work for nodejs

3 Likes

No, vanilla JS usually refers to JS in your browser. (Edit: misunderstood who the reply was to lol)

6 Likes

They didn’t say vanilla JS. They just said JavaScript. And since vanilla JS DOES have a function to accept input, I am pretty confident that they meant Node.js (not vanilla JS).

2 Likes

Matt probably thought you were replying to 9pfs.

2 Likes
process.stdin.on("data", (data) => {})

does it though.

4 Likes

really? :open_mouth:
I had no idea you could do that, and I have ~3 years of experience…I only ever used readline-sync for it :laughing:

2 Likes

Can’t you use prompt for frontend, and then if you wanna figure it out, use process.stdin?

Or you know, just

(almost repeated myself is why I just requoted lol)

Edit: A LOT of regurgitated information in this reply, so skim over it