var user
outside any function creates a variable in the global scope, so you can access it from any other file by simply using its name.
However, if your code is running e.g. in the nodejs environment where files have their own scopes you are out or luck - JavaScript does not have nice introspection tools that let you snoop into foreign scopes.