Thursday, November 26, 2009

JavaScript print (to console): Rhino

Rhino implements the core JavaScript language. There's no DOM in there to simulate a web browser, so to print lines to the quick & dirty JS shell, you have to use it's own print statement:

print("text here"); unlike the typical: document.write("text here");

the syntax here is just the same as building a JavaScript string: "literal text" + variable...

Likewise Max/MSP has it's specific: post("blah"); to print to the max message window.

1 comment:

Unknown said...

rhino is implementing it's print() function using some java class file's println function,
i wanted to ask, since there is no print() function specified in core javascript then how will someone know what to use for printing variables on rhino console
?