javascriptconsolerhino

console input function for rhino?


How do I accept a variable from the console with javascript in Rhino? anything similar to cin or scanf?


Solution

  • Here's two lines that'll do what you want:

    var stdin = new BufferedReader( new InputStreamReader(System['in']) )
    var aLine = stdin.readLine();