Here is some of the new JavaScript syntax:
Mail.outgoingMessages.whose({subject:'JavaScript'})
Here is what it looks like in AppleScript
tell application "Mail"
set msgs to every outgoing message whose subject is 'JavsScript'
end tell
After Microsoft made JavaScript "first class" programming language for WinRT (Windows 8.x apps), now even Apple made it able to create Mac scripts / apps.