Skip to main content
K.Daube
Community Expert
Community Expert
Jun 8, 2022 3:08 PM UTC
Answered

Again: undefined is not an object ...

Dear friends, I may be blind again - there was ample sunshine today...

In this snippet

if (oTR.beg.obj.ObjectValid()) {
$.writeln(oTR.beg.obj.constructor.name);
  oFound.object = oTR.beg.obj; 

At line 3 I get the error "undefined is not an object".

Line 2 outputs Pfg - so imho "oTR.beg.obj" is an object.

oFound is declared to be an object, as well as oTR is.

Where is my knot in t he brain?

 

This topic is closed to new replies. Start a new post to keep the conversation going.
4everJang
4everJangCorrect answer
Legend
Jun 8, 2022 4:40 PM UTC

Try this:
oFound.myObject = oTR.beg.obj;

It might be that the 'object' property conflicts with a reserved keyword in the scripting environment or language. So the error refers to the property you are trying to set, not the value you try to assign to it. 

2 replies

4everJang
4everJangCorrect answer
Legend
Jun 8, 2022 4:40 PM UTC

Try this:
oFound.myObject = oTR.beg.obj;

It might be that the 'object' property conflicts with a reserved keyword in the scripting environment or language. So the error refers to the property you are trying to set, not the value you try to assign to it. 

Translate
K.Daube
Community Expert
K.DaubeCommunity ExpertAuthor
Community Expert
Jun 9, 2022 7:28 AM UTC

Jang, you hit the nail! I should not have used here a propertyat all, because oFound is already used as the found object (Pgf etc.). And somewhere I have noted to avoid private property names resebling existing ones...

Translate