{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10962","repository_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10962/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10962/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10962/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/10962","id":179842977,"number":10962,"title":"what's wrong with this ?","user":{"login":"xgqfrms-GitHub","id":18028768,"avatar_url":"https://avatars.githubusercontent.com/u/18028768?v=3","gravatar_id":"","url":"https://api.github.com/users/xgqfrms-GitHub","html_url":"https://github.com/xgqfrms-GitHub","followers_url":"https://api.github.com/users/xgqfrms-GitHub/followers","following_url":"https://api.github.com/users/xgqfrms-GitHub/following{/other_user}","gists_url":"https://api.github.com/users/xgqfrms-GitHub/gists{/gist_id}","starred_url":"https://api.github.com/users/xgqfrms-GitHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xgqfrms-GitHub/subscriptions","organizations_url":"https://api.github.com/users/xgqfrms-GitHub/orgs","repos_url":"https://api.github.com/users/xgqfrms-GitHub/repos","events_url":"https://api.github.com/users/xgqfrms-GitHub/events{/privacy}","received_events_url":"https://api.github.com/users/xgqfrms-GitHub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-28T17:59:54Z","updated_at":"2016-09-28T18:20:58Z","closed_at":null,"body":"Challenge [Profile Lookup](https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20var%20a%3Dfalse%2Cb%3Dfalse%2Cx%3B%0A%20%20for(var%20i%3D0%3Bi%20%3C%20contacts.length%3Bi%2B%2B)%7B%0A%20%20%20%20if(firstName%20%3D%3D%3D%20contacts%5Bi%5D.firstName)%7B%0A%20%20%20%20%20%20a%20%3D%20true%3B%0A%20%20%20%20%7Delse%20if(contacts%5Bi%5D.hasOwnProperty(prop))%7B%0A%20%20%20%20%20%20b%20%3D%20true%3B%0A%20%20%20%20%20%20x%20%3D%20contacts%5Bi%5D%5Bprop%5D%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20if(%20a%20%3D%3D%3D%20true%20%20%26%26%20b%20%3D%3D%3D%20true)%7B%0A%20%20%20%20return%20x%3B%0A%20%20%20%20%2F%2Freturn%20the%20%22value%22%20of%20that%20property.%0A%20%20%7Delse%20if(a%20%3D%3D%3D%20true%20%26%26%20b%20%3D%3D%3D%20false)%7B%0A%20%20%20%20return%20%22No%20such%20property%22%3B%0A%20%20%7Delse%20if(a%20%3D%3D%3D%20false%20%26%26b%20%3D%3D%3D%20true)%7B%0A%20%20%20%20return%20%22No%20such%20contact%22%3B%0A%20%20%7Delse%7B%0A%20%20%20%20return%3B%0A%20%20%7D%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A) has an issue.\r\nUser Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36</code>.\r\nPlease describe how to reproduce this issue, and include links to screenshots if possible.\r\n\r\nMy code:\r\n```javascript\r\n\r\n//Setup\r\nvar contacts = [\r\n    {\r\n        \"firstName\": \"Akira\",\r\n        \"lastName\": \"Laine\",\r\n        \"number\": \"0543236543\",\r\n        \"likes\": [\"Pizza\", \"Coding\", \"Brownie Points\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Harry\",\r\n        \"lastName\": \"Potter\",\r\n        \"number\": \"0994372684\",\r\n        \"likes\": [\"Hogwarts\", \"Magic\", \"Hagrid\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Sherlock\",\r\n        \"lastName\": \"Holmes\",\r\n        \"number\": \"0487345643\",\r\n        \"likes\": [\"Intriguing Cases\", \"Violin\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Kristian\",\r\n        \"lastName\": \"Vos\",\r\n        \"number\": \"unknown\",\r\n        \"likes\": [\"Javascript\", \"Gaming\", \"Foxes\"]\r\n    }\r\n];\r\nfunction lookUpProfile(firstName, prop){\r\n// Only change code below this line\r\n  var a=false,b=false,x;\r\n  for(var i=0;i < contacts.length;i++){\r\n    if(firstName === contacts[i].firstName){\r\n      a = true;\r\n    }else if(contacts[i].hasOwnProperty(prop)){\r\n      b = true;\r\n      x = contacts[i][prop];\r\n    }\r\n  }\r\n  if( a === true  && b === true){\r\n    return x;\r\n    //return the \"value\" of that property.\r\n  }else if(a === true && b === false){\r\n    return \"No such property\";\r\n  }else if(a === false &&b === true){\r\n    return \"No such contact\";\r\n  }else{\r\n    return;\r\n  }\r\n// Only change code above this line\r\n}\r\n// Change these values to test your function\r\nlookUpProfile(\"Akira\", \"likes\");\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/comments/250254113","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/10962#issuecomment-250254113","issue_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10962","id":250254113,"user":{"login":"xgqfrms-GitHub","id":18028768,"avatar_url":"https://avatars.githubusercontent.com/u/18028768?v=3","gravatar_id":"","url":"https://api.github.com/users/xgqfrms-GitHub","html_url":"https://github.com/xgqfrms-GitHub","followers_url":"https://api.github.com/users/xgqfrms-GitHub/followers","following_url":"https://api.github.com/users/xgqfrms-GitHub/following{/other_user}","gists_url":"https://api.github.com/users/xgqfrms-GitHub/gists{/gist_id}","starred_url":"https://api.github.com/users/xgqfrms-GitHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xgqfrms-GitHub/subscriptions","organizations_url":"https://api.github.com/users/xgqfrms-GitHub/orgs","repos_url":"https://api.github.com/users/xgqfrms-GitHub/repos","events_url":"https://api.github.com/users/xgqfrms-GitHub/events{/privacy}","received_events_url":"https://api.github.com/users/xgqfrms-GitHub/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T18:20:58Z","updated_at":"2016-09-28T18:20:58Z","body":"I just confused of the test cases 2 & 3!\r\n\r\nThere should be the same result?\r\n\r\n> \r\n\"Sherlock\", \"likes\" should return [\"Intriguing Cases\", \"Violin\"]\r\n\"Harry\",\"likes\" should return an array\r\n\r\n```js\r\n    \r\n//Setup\r\nvar contacts = [\r\n    {\r\n        \"firstName\": \"Akira\",\r\n        \"lastName\": \"Laine\",\r\n        \"number\": \"0543236543\",\r\n        \"likes\": [\"Pizza\", \"Coding\", \"Brownie Points\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Harry\",\r\n        \"lastName\": \"Potter\",\r\n        \"number\": \"0994372684\",\r\n        \"likes\": [\"Hogwarts\", \"Magic\", \"Hagrid\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Sherlock\",\r\n        \"lastName\": \"Holmes\",\r\n        \"number\": \"0487345643\",\r\n        \"likes\": [\"Intriguing Cases\", \"Violin\"]\r\n    },\r\n    {\r\n        \"firstName\": \"Kristian\",\r\n        \"lastName\": \"Vos\",\r\n        \"number\": \"unknown\",\r\n        \"likes\": [\"Javascript\", \"Gaming\", \"Foxes\"]\r\n    }\r\n];\r\nfunction lookUpProfile(firstName, prop){\r\n// Only change code below this line\r\n  var a=false,b=false,x;\r\n  for(var i=0;i < contacts.length;i++){\r\n    if(firstName === contacts[i].firstName){\r\n      a = true;\r\n    }\r\n    if(contacts[i].hasOwnProperty(prop) === true){\r\n      b = true;\r\n      x = contacts[i][prop];\r\n    }\r\n  }\r\n  if( a === true  && b === true){\r\n    return x;\r\n    //return the \"value\" of that property.\r\n  }else if(a === true && b === false){\r\n    return \"No such property\";\r\n  }else if(a === false &&b === true){\r\n    return \"No such contact\";\r\n  }else{\r\n    return;\r\n  }\r\n// Only change code above this line\r\n}\r\n// Change these values to test your function\r\nlookUpProfile(\"Akira\", \"likes\");\r\n\r\n```\r\n![a](https://cloud.githubusercontent.com/assets/18028768/18926680/58f3678e-85eb-11e6-9d07-eb23a326ccbe.PNG)\r\n"}}
{"actor":{"display_login":"xgqfrms-GitHub"}}