Functional Programming - Understand the Hazards of Using Imperative Code

Sorry, I missed what you wrote originally, it was in a weird spot at the bottom of the post. Next time try to keep you questions in this section:

Tell us what’s happening:

Describe your issue in detail here.

I understand this step has a lot of text and code and it could look overwhelming. The code is a simulation of a web browser handling different tabs. It’s described here:

Consider the scenario: you are browsing the web in your browser, and want to track the tabs you have opened. Let's try to model this using some simple object-oriented code.

A Window object is made up of tabs, and you usually have more than one Window open. The titles of each open site in each Window object is held in an array. After working in the browser (opening new tabs, merging windows, and closing tabs), you want to print the tabs that are still open. Closed tabs are removed from the array and new tabs (for simplicity) get added to the end of it.

The code editor shows an implementation of this functionality with functions for tabOpen(), tabClose(), and join(). The array tabs is part of the Window object that stores the name of the open pages.

Examine the code in the editor. It’s using a method that has side effects in the program, causing incorrect behaviour. The final list of open tabs, stored in finalTabs.tabs, should be ['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab'] but the list produced by the code is slightly different.

Change Window.prototype.tabClose so that it removes the correct tab.

There is updates being made to the curriculum all the time and valid, well-explained issues are considered and improved in future updates.

If you take some time to consider the code presented make a thoughtful question about something specific you will have a much better chance of getting your questions answered and learning.

You can also try searching the forum for people who may have had similar questions.
https://forum.freecodecamp.org/search?q=Hazards%20of%20Using%20Imperative%20Code

Finally, if you click “Get Help” and then “Get a Hint” it will lead you to this guide that might help you if you are really stuck: https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-understand-the-hazards-of-using-imperative-code/301241

I would try editing those three lines indicated first:

// Only change code below this line

  const tabsBeforeIndex = this.tabs.splice(0, index); // Get the tabs before the tab
  const tabsAfterIndex = this.tabs.splice(index + 1); // Get the tabs after the tab

  this.tabs = tabsBeforeIndex.concat(tabsAfterIndex); // Join them together

  // Only change code above this line

Reading and understanding the code will be a much better learning experience.

Best of luck.