How to access environment variables in Javascript for Automation on OS X?
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')