Unit 6: Lesson 7


#1

var friends = {
bill: {
firstName:"Bill",
lastName:"Gates",
number:"(206) 555-5555",
address: ['One rainbow road']
},
steve: {
firstName:"Steve",
lastName:"Wozniak",
number:"(226) 555-5555",
address: ['Seven rainbow road']
}
};
var list = function (friends) {
for (var firstName in friends) {
console.log(firstName)
}
var search = function(friends) {
for (var key in friends) {
if (friends[key].firstName === name){
console.log (friends[firstName, lastName, number, address]);
return friends[key];
} else {
console.log ("non-existant");
}
}
};

It keeps saying "SyntaxError: Unexpected end of input".. I need help please.. Thanks


#2

Count your curly braces

Helps if you match your indentation to the braces so that you can tell if something's missing.

You can also prettify and run it in Firefox's scratchpad which is opened with Shift+F4


#3

Thanks a lot... but now it shows "Oops, try again. Did you create a function called search?"


#4

Test it and see if it's in working order


#5

I don't understand.. I used the same code, and counted the curly brackets


#6

If it's questioning the existence of something you think you've created, then it's probably not working in some way. So test it and find out in what way it misbehaves


#7

Oh.. ok thanks a lot.. I'll try that


#8

I haven't read your code or the instructions, but make sure you've understood the instructions correctly, it's not all that uncommon to implement something other than what's specified and therefore think that you meet specifications when really you are testing for something else