wrapping JS in closure