Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] TypeError: Can't read the protected property: findNearestItem

i got this error, the documentation is not clear to me. and related questions did not help when i searched the existing issues.

basically in this level i need my dog to find the potion and fetch it for me

Since this is a LEARNING site perhaps the document can discuss what a “protected property type” is and have an available hint with the solution when we are stuck.

Howdy and welcome to the forum!

What if there is no potion? There would be nothing to read, right?


I solved it after experimenting. Mainly to have the pet looking for items. And only bring back the potions.

var potion = pet.findNearestByType("potion");
if (potion) {
1 Like

why is it giving you credit for solving. you only vaguely gave a hint.

1 Like

Actually, that was set by one of the other Leaders…most likely because that vague hint gave you the nudge to explore a bit more.

And i absolutely appreciate your time and the nudge.

I am just used to StackOverflow where I would only get credit when an answer has a clear explanation.

1 Like

Thanks :slight_smile:

We try to help by guiding, hinting, etc when ever we can. The goal is to help folks truly learn the concept, and hopefully understand why there was an issue (or error) in the first place.