some utility methods for javascript