Some common utility functions for JavaScript