JavaScript util methods