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.

  1. Add the item to the end of the pouch using the .push() method.
  2. Return the updated pouch array.

01EXAMPLE 1

Inputpouch = ["Sword"], item = "Shield"
Output["Sword", "Shield"]

Constraints

  • Add correctly to the end.
  • Return the array.
FundamentalsArraysMethods
JavaScript
Loading...
3 Hidden

Input Arguments

pouch["Sword"]
item"Shield"

Expected Output

["Sword","Shield"]

Click RUN to test your solution