美文网首页
javaScript修改Object的Key值保留Value

javaScript修改Object的Key值保留Value

作者: kangaroo_v | 来源:发表于2018-08-15 16:51 被阅读0次
    for(var key in this.billList){ 
        //是否是billList自己身上的key
        if(this.billList.hasOwnProperty(key)){
            this.newList = Object.defineProperty(this.billList,this.time(key),Object.getOwnPropertyDescriptor(this.billList,key)) 
            delete this.newList[key] 
        } 
    }
    

    参考1:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
    参考2:https://blog.csdn.net/starwavelin/article/details/75270572

    相关文章

      网友评论

          本文标题:javaScript修改Object的Key值保留Value

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