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

Heatherdawn Wadleigh
Heatherdawn Wadleigh
12,301 Points

Student Record Search Challenge Solution

My solution builds upon code added by Chase Frankenfeld (specifically, notifying the user if they've already searched for a name).

I added the ability for the user to receive notice if they perform a duplicate search, or if they enter a name NOT in our object (our list of student names).

I also added a small conditional to make sure we don't see duplicate info in the DOM. For instance, if "Alex" is in our object, and they search for "Alex" three times, it will only show once in the DOM (in the search results).

I'm sure this could be edited down, as I'm looping through the object TWICE, to do two different things.

http://codepen.io/elmnt/pen/RRPObp

1 Answer

Steven Parker
Steven Parker
229,657 Points

It seems to work very well. Good job! :+1: