Is there a way to read standard input with JavaScript?

后端 未结 5 605
名媛妹妹
名媛妹妹 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:31

    It's not in the ECMAScript (standardized version of JavaScript) standard library. However, some implementations of JavaScript do include it. For example, CommonJS, which is used by several out-of-the-browser JavaScript environments, has a system.stdin property. Rhino can use Java's standard input classes.

    If you're just trying to practice programming, you can use a textarea as a substitute for standard input.

提交回复
热议问题