The Fusion Protocol

Easy+20 XP

Mission Briefing

Two rival factions have finally agreed to an alliance. You must write a fusion protocol that safely merges both factions' rosters into a unified team.

The Concept: Merging Arrays

The .concat() method merges two or more arrays end-to-end. It does not change the original arrays but returns a brand new combined array. Example: [1].concat([2]) // Returns [1, 2]

The Objective

Your function receives two arrays: arr1 and arr2.

  1. Merge them together so that all elements of arr1 appear first, followed by all elements of arr2.
  2. Return the single newly combined array.

01EXAMPLE 1

Inputarr1 = [1, 2], arr2 = [3, 4]
Output[1, 2, 3, 4]

Constraints

  • Use the .concat() method.
CoreArraysMethods
JavaScript
Loading...
3 Hidden

Input Arguments

arr1[1,2]
arr2[3,4]

Expected Output

[1,2,3,4]

Click RUN to test your solution