Checking this Mac…
Script
AppleScript
JavaScript (JXA)
args
tell application "System Events" to tell appearance preferences to get dark mode
Check syntax
Run
applet name
Build automation app
Results show here. JXA scripts should end in return JSON.stringify(...).