var can easy to access between the function and files, can you declare var as global, re-declare the variable and update the values.
Read this post on codeasearch.com