How do I accept a variable from the console with javascript in Rhino? anything similar to cin or scanf?
Just use the Java class library. I think this will work: var stdin = java.lang.System.in; var line = stdin. readLine();
Rhino is a JavaScript engine written fully in Java and managed by the Mozilla Foundation as open source software.
Here's two lines that'll do what you want:
var stdin = new BufferedReader( new InputStreamReader(System['in']) )
var aLine = stdin.readLine();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With