Tell us what’s happening:
I understand mostly how this is working, but only after looking up the solution - my own code didn’t even come close!
A couple questions:
- After the
forloop, what does this part mean:
if (contacts[i].firstName === name)
I understand this as tying the
for loop into the nested if statement. This would allow the code to iterate through the
contacts array to begin checking each property against the
name provided in the function. Correct? While I still am unclear on the
for loops when used for recursion, I’m understanding that using a
for loop allows you to iterate through an array to check for a condition and that this will need to be tied into the executable(?) statement. Also correct?
- On this line of code:
i now stand in for the firstName property? I thought it would be:
return [firstName][prop] - which did not work when I tried, lol.
What’s the difference? The console says
firstName not defined when I tried it my own way. I even tried putting
firstName in quotes and that didn’t work either.
I appreciate any clarification!!!
Your code so far
**Your browser information:**
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62
Challenge: Profile Lookup
Link to the challenge: