As a language which is built for the web, command line input is not a built-in functionality of the language.
Yes there is!!
I am gonna introduce you a npm package readlineSync, It implemented all the functionality we need to take input form the user on a command line.
You can install it in your working folder by
Now that you installed readlineSync let’s see some simple example using the same
Let’s ask user name and say hello.
In order to readlineSync do the magic we need to import it first
Now let’s ask user to input.
In the console
Now let’s look when you want to enter secret information
This will result in
There are many functionality for readlineSync do checkout their doc.
Hope this gives a quick intro towards readlineSync
Happy coding :)