I’m looking for the javascript equivalent of Python2.x’s print "hi".
I’m working with the Rhino javascript interpreter in the ubuntu terminal.
When I type:
document.write{"hi"}
I get the error that ‘document’ is not defined.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JavaScript doesn’t have any built in methods to provide output. Scripts have to depend on features provided by the host environment for that.
documentis an object that is available in web browsers, but not in Rhino. Even if it was available,document.writeis a function. You use()to call a function, not{}.Rhino provides a
printfunction.