JS Solution

Pretty simple JS solution.
changed folder
window -> var

oops, leaked this one in when changing folders.
Merge pull request #32 from JAStanton/master

JS Solution (pull request)