Skip to main content
K.Daube
Community Expert
Community Expert
June 8, 2022
Answered

Again: undefined is not an object ...

  • June 8, 2022
  • 1 reply
  • 432 views

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 has been closed for replies.
Correct answer 4everJang

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. 

1 reply

4everJang
4everJangCorrect answer
Legend
June 8, 2022

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. 

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthor
Community Expert
June 9, 2022

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...