Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
144
rated 0 times [  148] [ 4]  / answers: 1 / hits: 64750  / 14 Years ago, tue, march 22, 2011, 12:00:00

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 standard in like C++ and other languages do.



EDIT: Thanks for the answers. The primary reason I want this functionality is so I can answer the questions on CodeChef; Codechef sends multiple inputs to the files/programs that are the answers (and of course the programs have to respond in the required way for the answer to be correct).


More From » stdin

 Answers
74

It depends on the environment that your JavaScript is executing in.


In the browser, there is no standard input (the browser isn't a console). The input would come generally from some textbox element in a form on the page.


If you're using something like Rhino, then you can import the standard Java I/O classes and read from stdin that way.


[#93135] Monday, March 21, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
morrismilom

Total Points: 230
Total Questions: 96
Total Answers: 114

Location: Mayotte
Member since Mon, Sep 12, 2022
2 Years ago
;