Profile lookup error for all test case

Tell us what’s happening:
why my code is not working??
Your code so far

// Setup
var contacts = [
     "firstName": "Akira",
     "lastName": "Laine",
     "number": "0543236543",
     "likes": ["Pizza", "Coding", "Brownie Points"]
     "firstName": "Harry",
     "lastName": "Potter",
     "number": "0994372684",
     "likes": ["Hogwarts", "Magic", "Hagrid"]
     "firstName": "Sherlock",
     "lastName": "Holmes",
     "number": "0487345643",
     "likes": ["Intriguing Cases", "Violin"]
     "firstName": "Kristian",
     "lastName": "Vos",
     "number": "unknown",
     "likes": ["JavaScript", "Gaming", "Foxes"]

function lookUpProfile(name, prop){
// Only change code below this line
for(var i=0;i>contacts.length;i++){
    if(contacts[i].prop !=undefined){
      return contacts[i].prop    
    }else{return "No such property"}
}else{return "No such contact"}
// Only change code above this line

 **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4464.5 Safari/537.36.

Challenge: Profile Lookup

Link to the challenge:

What does that mean?

I’m trying to do profile lookup challenge but my code isn’t working .can you please find out the mistake??

Your code formatting makes it very difficult to understand your code. I have reformatted your code to make it easier to see how the logic nests.

What is

doing on its own line? It does not appear to do anything.

Will these loop bounds ever result in the loop body executing?

Under which circumstances will this statement execute? Keep in mind, a return statement immediately halts a function and returns the specified value.

It is really helpful to learn how to articulate problems with code. “It doesn’t work” does not provide much information that people can use to help you. If you are asking someone to give you help, it is easiest for them to give help if you give them as much information as you can.

Also, learning how to articulate problems helps increase your understanding and it help you troubleshoot on your own. This is known as ‘rubber duck debugging’.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.