Small JavaScript functions for common use cases.