Manipulate Arrays With pop
This commit is contained in:
committed by
SaintPeter
parent
be910aa42d
commit
479bf29e05
@ -1593,8 +1593,9 @@
|
|||||||
"title": "Manipulate Arrays With pop()",
|
"title": "Manipulate Arrays With pop()",
|
||||||
"description": [
|
"description": [
|
||||||
"Another way to change the data in an array is with the <code>.pop()</code> function.",
|
"Another way to change the data in an array is with the <code>.pop()</code> function.",
|
||||||
"<code>.pop()</code> is used to \"pop\" a value off of the end of an array. We can store this \"popped off\" variable by performing <code>pop()</code> within a variable declaration.",
|
"<code>.pop()</code> 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.",
|
||||||
"Any type of data structure can be \"popped\" off of an array - numbers, strings, even nested arrays.",
|
"Any type of entry can be \"popped\" off of an array - numbers, strings, even nested arrays.",
|
||||||
|
"For example, for the code<br><code>var oneDown = [1, 4, 6].pop();</code><br>the variable <code>oneDown</code> now holds the value <code>6</code> and the array becomes <code>[1, 4]</code>.",
|
||||||
"<h4>Instructions</h4>",
|
"<h4>Instructions</h4>",
|
||||||
"Use the <code>.pop()</code> function to remove the last item from <code>myArray</code>, assigning the \"popped off\" value to <code>removedFromMyArray</code>."
|
"Use the <code>.pop()</code> function to remove the last item from <code>myArray</code>, assigning the \"popped off\" value to <code>removedFromMyArray</code>."
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user