Skip to content

Object.prototype,map #589

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
}

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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