I saw this for lots of other languages but not JavaScript.
I\'m trying to do problems like: this (codechef.com) and of course the programs need to be able to read
Use just readline()
var a = readline();
the value which you give input will be stored in variable a.
readline() : Reads a single line of input from stdin, returning it to the caller. You can use this to create interactive shell programs in JavaScript.