Reading strings
We can read a single line string using the built-in functions process.stdin
:
To fetch data from a stdin you can use process.stdin
and send fetching result to a custom parsing function (parsingFunction
)
Following examples assume you are implementing parsingFunction
content
|
|
Reading an array of integers
When you need to convert a string of integers (eg. 1 2 3
) to an array of integers [1, 2, 3]
each element to an int:
|
|
Reading n rows made up of a single integer
|
|
Writing on STDOUT
When you need to write on stdout use:
|
|