0

I want to test a piece of a very simple javascript and print out the result. The Script Editor however only prints out undefined in the Result pane.

enter image description here What is the easiest way to print out the result?

2 Answers 2

3

The result pane displays the result of the evaluation so the easiest way to print the result is to execute:

Math.round(5.0/2)

Using console.log() does work from the command line:

osascript -l JavaScript -e 'console.log(Math.round(5.0/2))'
2

In the status bar you should notice an information icon, a carriage return icon and a menu icon.

The carriage return icon is the result.

Select the menu icon and you get four selects.

The one you want is messages. It will show you your console.log print out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .