How to access environment variables in Javascript for Automation on OS X?

I am using JavaScript for Automation in an Alfred workflow. I want to access the various environment variables that Alfred sets up. How do I access the environment variable like alfred_version?


I do not have Alfred installed however I would think the following method should work.

For example, using the Script Editor set to JavaScript the following code returned my login name.

ObjC.import('stdlib')
$.getenv('LOGNAME')

So, I'd assume that if "alfred_version" is the actual environment variable, then the following might work as well.

ObjC.import('stdlib')
$.getenv('alfred_version')