javascript - JS deletes elements based on key and returns the length. The difference with splice is that it deletes based on position and the length is not updated.
淡淡烟草味
淡淡烟草味 2017-05-18 11:01:17
0
2
450

Like the title, is there such a method?

淡淡烟草味
淡淡烟草味

reply all (2)
某草草

The element is deleted, but the original address is still retained, so the subsequent elements must be moved forward. This will reduce the number of elements and update the length

    我想大声告诉你

    Will be updated

    var tt = [1, 2, 3]; tt.length // 3 tt.splice(0, 1); // [1] tt.length //2

    For your needs, you can write a method yourself and encapsulate splice:

    function my_splice(arr, start, length) { arr.splice(start, length); return arr.length; }
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!