Joining Arrays With concat()

The pager’s escalation list needs the next three people on call, followed by the managers, Priya and Tom. Your Monday script already gets Dev, Sam, and Ines with rota.slice(0, 3). Now you’ll join those arrays and report the count, so the person holding the pager knows who to wake.

Build the Escalation List

In Python, escalation = rota[:3] + managers produces a new five-person list. Carry that + into JavaScript, with .length replacing len(). Before running this port, predict the result’s type and count:

Language: JavaScript
const rota = ["Dev", "Sam", "Ines", "Kofi", "Bea", "Marta"];
const managers = ["Priya", "Tom"];

const escalation = rota.slice(0, 3) + managers;
console.log(escalation);
console.log(typeof escalation);
console.log(`Escalation list: ${escalation.length} people`);

JavaScript runs without an error and prints:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.