Profile Search: how do nested if statements ensure that the returned prop matches the name?

In the Profile Search exercise, I finally surmised, from some forum hints, that nested if statements are the way to solve this problem.

While I understand how the conditions are being met to evaluate the next line of code, I don’t fully understand how this method ensures that the returned prop value and the firstName value are within the same object. Or, to put it another way, I don’t understand how the returned prop value and the firstName value match using this technique.

Can someone break this down for me?

Any help is greatly, greatly appreciated!

This strongly depends on how you wrote your solution. Could you post your code here? Wrap it in spoiler tags and backticks.

[spoiler]
    ```
        function codeGoesHere() {
            // Stuff!
        }
    ```
[/spoiler]

It will look like this (click on the blurriness):

function codeGoesHere() {
     // Stuff!
 }