One liner to delete multiple object properties

前端 未结 3 1432
被撕碎了的回忆
被撕碎了的回忆 2021-01-21 22:29

I have a few object properties I need to delete at certain point but I still need others so I can\'t just write delete vm.model; to remove all of it.

At the

3条回答
  •  醉酒成梦
    2021-01-21 22:42

    There is no much you can do to simplify it, you can use an array

    ["a","b","c"].forEach(k => delete vm.model[k])
    

提交回复
热议问题