The problem is the Javascript language requires you to import the Cocoa stuff
ObjC.import('Cocoa')
And then you get stuff like
task = $.NSTask.alloc.init task.running == task.isRunning
The AppleScript version
if application "iTunes" is running then --- Do stuff... end if
It may just be me, but in some cases the AppleScript version is easier and better.