The Load Out
Easy+20 XP
Mission Briefing
The Guild's inventory is expanding rapidly! You need to load newly crafted gear into the cargo bays without disturbing the items already stored.
The Concept: Array Mutators (Push)
The .push() method adds one or more elements to the end of an array. It mutates (changes) the original array directly.
Example:
let bag = ["Book"]; bag.push("Laptop"); // bag is now ["Book", "Laptop"]
The Objective
Your function receives an array pouch and a new item.
- Add the
itemto the end of thepouchusing the.push()method. - Return the updated
poucharray.
01EXAMPLE 1
Input
pouch = ["Sword"], item = "Shield"Output
["Sword", "Shield"]Constraints
- Add correctly to the end.
- Return the array.
FundamentalsArraysMethods
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
pouch["Sword"]
item"Shield"
Expected Output
["Sword","Shield"]
Click RUN to test your solution