With regards to the brackets around the "prop" as property

Tell us what’s happening:
Describe your issue in detail here.
The question asks if prop does in fact exist as a property, I’ve found that I don’t pass the task without the brackets () being around the prop property (please find in bold), if they’re not there the task doesn’t pass, now I understand that the question specifies for brackets to be put with prop but my question is…in the previous lessons we were told to use either square brackets or the actual property with a period in between. First question: is it common practice to use brackets somewhere down the road in instances like this (with regards to record finding) or is it just because the question now asks for brackets, question #2: what about square brackets or period when using brackets?? Had I not looked at the answer I would never have passed because of this period that I would’ve added because it’s been taught to use period or square brackets as to do with properties
Thanks in advance

From a newb (knows NOTHING of js besides what was taught here)

  **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;contacts[i];i++){
    if (name==contacts[i]["firstName"]){
       if (contacts[i].hasOwnProperty(prop)){
        return contacts[i][prop];
    return "No such property";


    return "No such contact";

// Only change code above this line

lookUpProfile("Akira", "likes");
/*for (let x = 0; x < contacts.length; x++) {
  if (contacts[x].firstName === name) {
    if (contacts[x].hasOwnProperty***(prop*)**) {
      return contacts[x][prop];
    } else {
return "No such contact";*/

  **Your browser information:**

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

Challenge: Profile Lookup

Link to the challenge:

hasOwnProperty is a method, it is a type of function, which you need to call using the round parenthesis and an argument in them

this round parenthesis is not related to bracket or dot notation used to access object properties

true…lol, I FORGOT about that lol

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