How to remove a property from an object?

前端 未结 2 1116
后悔当初
后悔当初 2020-12-31 01:30

Currently an event is set on checkboxes, and event.target gives me the status (checked = true/false) of checkbox which is clicked.

2条回答
  •  执念已碎
    2020-12-31 01:59

    What you have is an object and not an array (although an array is an object). You declare an object literal with {} whereas an array literal is declared with [].

    You can use delete to remove an object property like so

    delete selectedMap[event.target.id];
    

提交回复
热议问题