How to ease into longer code and more complex functionality

He guys, it was my first time reading 40+ line of code. Do you have any suggestions when reading longer lines of code?

As far as the solution, I realized slice would fix the problem, but honestly this is a jump from the past exercises (both in length and complexity) - thanks!

Your code so far

// tabs is an array of titles of each site open within the window
var 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

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

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

 // Only change code above this line

 return this;

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

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

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36.

Challenge: Understand the Hazards of Using Imperative Code

Link to the challenge:

HI @am93 !

I would just break it up into sections and then read each section at a time.
For this particular problem, it kind of broken into pieces because of the comments in there.

I wish I could say it gets easier but that is a complete lie.
These last two sections (functional and intermediate) before the projects will challenge you a little bit.
If you need to review some of these concepts more in depth before you tackle the algorithms, then there are plenty of great sources for beginners to do that.
Of courses there is documentation to use as well.

Also, I added some spoiler tags to your code since this is a working solution.

1 Like

I see. I guess it’s sort of a good thing it’s getting longer, if it means I’m getting closer to using functional code that I can build projects with. But yeah here comes the struggle lol

Sorry I forgot what the spoiler tags were :confused:

The javascript projects are technically 5 more algorithm challenges.
But in the front end section, you will start to build projects with react,html and css.

But you can also start to build side projects to help with your understanding of this material.

Gotcha. I had someone recommend me to learn react and next.js straight from their documentation after this course. Just curious what would you recommend?

To be specific they said: responsive web cert, javascript alg and data structure cert, react, tailwind css, nd next.js from their own docs.

I know there’s a lot of different paths. If it helps my goal is to build web apps with front and back end.

I use the react docs a lot for the projects.
Especially for the section on hooks since that is not taught in the current FCC curriculum.

But I would first learn react and do some projects with react before I start messing around with different js libraries and frameworks.

The front end section teaches, Bootstrap, Sass, jquery, react and redux.

You can technically build the projects using any combination of those languages but it would probably be best to do at least one project using react.

The next three certifications will move towards backend with node js.
After you complete the first six certifications of the FCC curriculum then should be able to start building your own full stack projects.

1 Like

Gotcha. Just curious, would you say that there is a lower learning loop after a certain point into the certifications? For example, is there typically more struggle moving from html/css to JS than there is for data visualizations to APIs? Thanks

I definitely think the biggest jump is from markup languages to your first programming language.
So it doesn’t really get easier but it is not as much of a learning curve.

I just started another side project and reading through the node docs and mongodb docs. While it is all new for me, I am not struggling like I was when I first started javascript.

1 Like

Got it, thank you for all your insight!