Javascript Array firstKey()

Description

Javascript Array firstKey()

/**// w  w w .  j  a  va  2s. com
 * Note that arrays with strings as key are actually objects, and depending on implementation may not be ordered
 * @returns {*} first key of array
 */
Array.prototype.firstKey = function () {
    for (key in this) {
        return key;
    }
};



PreviousNext

Related