The search function in the following code is not working and I believe it has something to do with the For...In loop but I am new to JS and unsure why:
var frien
The for in loop iterates over keys, not values.
for in
friend is a string holding the name of each property. To get the value, use friends[friend].
friend
friends[friend]