Empty output when using some shell commands via AppleScript's "do shell script"
console.log within osascript outputs to stderr (standard error), not stdout (standard out). Redirect stderr to stdout for the output to be captured to a variable using 2&gt;&amp;1.
set theResult to do shell script "osascript -l JavaScript 2>&1 &lt;&lt; EOF
console.log('everything');
EOF"