Understand the Hazards of Using Imperative Code: Why so complicated?

Tell us what’s happening:
Hey, i solved the challenge, but i am suprised why the solutions are so complicated?

Is there a educational reason for later challenges?

I just used splice as in the MDN recommended, to delete x elements at index y (example 3):

Why to use splice two times + a .join-method?

Or is there a disadvantage with my way?

Sorry to bother you guys and girls with this question, when i already passed the test, but i dont want to skip elemental learnings.

   **Your code so far**

// tabs is an array of titles of each site open within the window
const Window = function(tabs) {
 this.tabs = tabs; // We keep a record of the array inside the object
};

// When you join two windows into one window
Window.prototype.join = function(otherWindow) {
 this.tabs = this.tabs.concat(otherWindow.tabs);
 return this;
};

// When you open a new tab at the end
Window.prototype.tabOpen = function(tab) {
 this.tabs.push('new tab'); // Let's open a new tab for now
 return this;
};

// When you close a tab
Window.prototype.tabClose = function(index) {

 // Only change code below this line

 const tabsBeforeIndex = this.tabs.splice(index, 1); 
 

 // Only change code above this line

 return this;
};

// Let's create three browser windows
const workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
const socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
const videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites

// Now perform the tab opening, closing, and other operations
const finalTabs = socialWindow
 .tabOpen() // Open a new tab for cat memes
 .join(videoWindow.tabClose(2)) // Close third tab in video window, and join
 .join(workWindow.tabClose(1).tabOpen());
console.log(finalTabs.tabs);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

Challenge: Understand the Hazards of Using Imperative Code

Link to the challenge:

If you’re asking about the sample solutions that can be found for the challenges, always keep in mind that they are not necessarily optimal solutions. They’re just examples of ways that you can solve the problem. Solutions were contributed by campers over the years.