Deleting array elements in JavaScript - delete vs splice

后端 未结 27 3586
予麋鹿
予麋鹿 2020-11-21 05:31

What is the difference between using the delete operator on the array element as opposed to using the Array.splice method?

For example:

myArray = [\         


        
27条回答
  •  渐次进展
    2020-11-21 06:15

    For those who wants to use Lodash can use: myArray = _.without(myArray, itemToRemove)

    Or as I use in Angular2

    import { without } from 'lodash';
    ...
    myArray = without(myArray, itemToRemove);
    ...
    

提交回复
热议问题