Другой способ изменить данные в массиве - с помощью функции <code>.pop()</code> . <code>.pop()</code> используется для « <code>.pop()</code> » значения из конца массива. Мы можем сохранить это значение «выскочил», присвоив его переменной. Другими словами, <code>.pop()</code> удаляет последний элемент из массива и возвращает этот элемент. Любой тип записи можно «выскочить» из массива - числа, строки, даже вложенные массивы. <blockquote><code>var threeArr = [1, 4, 6]; <br> var oneDown = threeArr.pop(); <br> console.log(oneDown); // Returns 6 <br> console.log(threeArr); // Returns [1, 4]</code></blockquote>
Используйте <code>.pop()</code> чтобы удалить последний элемент из <code>myArray</code> , назначив значение «popped off» для <code>removedFromMyArray</code> .