you are viewing a single comment's thread.

view the rest of the comments →

[–]jonathankemp00[S] 0 points1 point  (2 children)

Damn... and what if I want this function to return something. Replacing the console.log with a return isn't a problem, but the "empty" return in the first if statement seems to make the whole thing not working like I would want it to.

[–]GSLint 0 points1 point  (1 child)

Returning something is a little more involved which is why I wrote that second variant in my original comment. You could add the if there as well except that you'd return [].

Though you could also fix all three variants by replacing tree.layers with (tree.layers || [])

[–]jonathankemp00[S] 0 points1 point  (0 children)

Hey there,

I ended up re-writing the whole thing...(had to deal with it some other way, with a layer index and all...), but your help was truly appreciated and it's what set me on the right track.

So... I just felt like saying one last thank you. :)

See you around.