move change to Array.prototype to a utility method to have less impact on other people's JavaScript