Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Local Storage Project

Cynthia Norwood
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Cynthia Norwood
Front End Web Development Techdegree Graduate 15,214 Points

Local storage not saving search

Here is the snapshot, I checked the code against this workshop but I don't see any errors. Error in console is (index):81 Uncaught TypeError: recentSearches.forEach is not a function at window.onload ((index):81) https://w.trhou.se/az5r8qtzoc

I forked your snapshot, and I am not getting any console errors; everything seems to be working ok. What chain of events caused this error that you are seeing?

3 Answers

Haley Bengtson
seal-mask
.a{fill-rule:evenodd;}techdegree
Haley Bengtson
Front End Web Development Techdegree Student 14,334 Points

Thanks for posting your comment here because I was having the same problem with my browser. I cleared localStorage and it was finally working!

Steven Parker
Steven Parker
231,275 Points

I was also unable to replicate the issue, but I did notice the "clear" function wasn't working:

    localStorage.removeItem('removeSearches');  // you probably meant 'recentSearches' here