5 times JavaScript in 1 line of code.

Did you know its possible to execute JavaScript 5 different ways in AS in 1 line of code.

JSC is from JavaScriptCore framework I had to made symbol link to /usr/local/bin
(You could find it if you do a search on your machine)

Ps. I didn’t include ASObjC with JavaScriptCore framework… its more an 1 line of code.

Node is installed from brew and its version 18.

I try Google-Chrome but couldn’t get it to work.

set nodeJavaScript to do shell script "/opt/homebrew/bin/node <<EOF" & linefeed & "console.log(Math.sin(1))"
log nodeJavaScript
set osaJavaScript to do shell script "osascript -l JavaScript -e 'Math.sin(1)'"
log osaJavaScript
tell application "Safari" to set sfJavaScript to do JavaScript "Math.sin(1)" in document 1
log sfJavaScript
set jscScript to do shell script "/usr/local/bin/jsc <<EOF " & linefeed & "Math.sin(1)"
log jscScript
set jsRunScript to run script "Math.sin(1).toString()" in "JavaScript"
log jsRunScript

Here’s another:

tell application "Google Chrome" to set jsScriptResults to execute (active tab of window 1) javascript "Math.sin(1)" 
log jsScriptResults