类数组

作者: 大菜鸟呀 | 来源:发表于2018-10-21 20:11 被阅读11次
    var obj={
        '0':'a',
        '1':'b',
        '2':'c',
        'length':'3',
        'push':Array.prototype.push
    }
    
    //属性要为索引(数字)属性,必须有length属性,最好加上push方法
    
    
    var obj={
        '2':'a',
        '3':'b',
        'length':'2',
        'push':Array.prototype.push
    }
    obj.push('c')
    obj.push('d')
    //属性要为索引(数字)属性,必须有length属性,最好加上push方法
        {2: "c", 3: "d", length: 4, push: ƒ}

    相关文章

      网友评论

          本文标题:类数组

          本文链接:https://www.haomeiwen.com/subject/uekizftx.html