Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No proper way of taking process.stdin input using JavaScript? #670

Open
Omar-Walid-MD opened this issue Jun 5, 2024 · 3 comments
Open

Comments

@Omar-Walid-MD
Copy link

Functions like prompt() and readLine() aren't defined and their packages cannot be imported. Is there a way to read input using JavaScript?

@Brikaa
Copy link
Member

Brikaa commented Jun 6, 2024

You need to use the NodeJS ways of getting the stdin like process.stdin
image

@Omar-Walid-MD
Copy link
Author

Thanks. Is there any way it can be used in a function that works in a similar way to python's input? Something like "const n = input()"

@Brikaa
Copy link
Member

Brikaa commented Jun 6, 2024

There are multiple ways to read from stdin in NodeJS. You can use ones that don't require external NPM modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants