Learn server testing with tdd quiz

From the quiz: Why is the following test failing?

const pets = '<html><div id="dog"></div><div id="cat">Spot</div><html>';
const dogName = 'Spot';
assert.include(parseTextFromHTML(pets, '#dog'), dogName);

I see the answer, but I still don’t understand it. Can anyone clarify?


More specifically, I’m not sure why # is included in (parseTestFromHTML(pets, '#dog'), dogName);

I phoned a friend:

means id when you are trying to grab something off the DOM.

#cobOfCorn will look for an html element with the id="cobOfCorn "

.cobOfCorn will look for anything with the class="cobOfCorn "

A CSS id selector apparently is what that # is known as in this context.

#nav selects the elements with the ‘nav’ Id