Answer the question
In order to leave comments, you need to log in
How to remove elements from an array so that it is not replaced by null?
Hello, removing some element from the array, this element turns into null for me. How can this be fixed?
delete message.user
// ->
[{ ..., null, ... }]
Answer the question
In order to leave comments, you need to log in
const arr = [1, 2, 3];
let index = 1; // берем индекс двойки.
let count = 1; // сколько вырезать элементов
arr.splice( index, count );
console.log( arr ); // [1, 3]
Do not use an array as an object (convert using Object.assign) or Map , in which case the sequence may be broken, and the order of elements by key may not be in order
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question