How can I delete the proper object property value in JS

  javascript

I am working through a little practice assignment and have come across this question and for the life of me can’t figure it out.
There are tests parameters that I can’t see. The object is not a variable I can see, it’s just assumed.

Write a function called removePassword that takes in an object.
Delete the property password and return the object.

removePassword=(object)=>{
for(var key in object){
  if(object = object[key]){
  delete object[key]
    }
  }return object;
}

I have tried a bunch of different versions of this code, but I don’t know how to just delete the property password only without deleting the other property which is a username

Source: Ask Javascript Questions

LEAVE A COMMENT