the scoping of functions with js