0

I'm working in javascript

This is my text editor (NotePad++) Editor Picture

This is my console (Chrome) Console Picture

We see that on line 278 I output to console "this.Position" which we clearly see on the console is GVar.Position3d {X: -30, Y: -30, Z: 0} and its exactly the expected output.

Then on the next line 279, I output the exact same "this" but without ".Position". On the console the exact same "Position" is now a stupid array(3) coming out of nowhere filled with NaN.

Man this is so annoying been in this dead end for days.

Does anyone have any clues of what is going on here?

  • See the duplicates for the cause. Specifically, notice the `{Position: G…r.Position3d}` in the unexpanded version. That means something else set `this.Position` to an array between when it was logged and when you expanded it. – Ry- Jan 03 '20 at 07:25
  • I do have a worker that pop out when its ready, here it seems that it pops right between the log and the expansion. Do you think I should implement a mutex/lock like code? – PochardGalactique Jan 03 '20 at 23:27
  • No, I think you should fix whatever is setting `Position` to an array. – Ry- Jan 03 '20 at 23:49
  • Ok I found out what piece of code was guilty. Fixed. Thank you so much bud I'm pretty sure I would still be stuck without you. I've been coding for years and never been that stuck. So if I'm correct, there was a function that was switching to an array while the DOM was being logged to the console? And the output would half fix itself? – PochardGalactique Jan 04 '20 at 00:27
  • Not while, but after. The line you see in the console is evaluated when the value is logged, but when you click on the arrow to expand it, it shows you the values at the time you click it. (And this isn’t DOM, rather any JavaScript value that can have its properties changed.) – Ry- Jan 04 '20 at 01:15

0 Answers0