Is there a way to read standard input with JavaScript?

后端 未结 5 614
名媛妹妹
名媛妹妹 2020-12-08 20:09

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

5条回答
  •  旧时难觅i
    2020-12-08 20:34

    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.

提交回复
热议问题