Skip to content

Object.prototype,map #589

Open
Open
@luo29

Description

@luo29

`
Object.prototype.map = function(callback){
if(typeof callback !== "function"){
throw new TypeError("param must be a Function")
}
const newObj = {}
for(const key in this){
if(this.hasOwnProperty(key)){
newObj[key] = callback(this[key],key,this)
}
}
return newObj
}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions