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...
Watch video Basic JavaScript (42/111) | Manipulate Arrays With pop() | freeCodeCamp online, duration hours minute second in high quality that is uploaded to the channel Stral Tech 03 September 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 667 times and liked it 3 visitors.