Basic JavaScript (42/111) | Manipulate Arrays With pop() | freeCodeCamp
Full playlist 👉 • Basic JavaScript (1/111) | Comment Yo...
Another way to change the data in an array is with the .pop() function.
.pop() is used to "pop" a value off of the end of an array. We can store this "popped off" value by assigning it to a variable. In other words, .pop() removes the last element from an array and returns that element.
Any type of entry can be "popped" off of an array - numbers, strings, even nested arrays.
var threeArr = [1, 4, 6];
var oneDown = threeArr.pop();
console.log(oneDown); // Returns 6
console.log(threeArr); // Returns [1, 4]
Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
https://www.freecodecamp.org/learn/ja...
Смотрите видео Basic JavaScript (42/111) | Manipulate Arrays With pop() | freeCodeCamp онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Stral Tech 03 Сентябрь 2020. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 667 раз и оно понравилось 3 посетителям.