I don’t understand exactly what’s happening here, it seems that’s a syntax issue. Just in case it might be helpful, I’m very new to Javascript, but I have experience with AS3.
On this code:
https://github.com/mrdoob/three.js/blob/master/examples/canvas_lines.html
Line 34 is:
camera, scene, renderer;
I assumed these were variable declarations on the global scope, and also that in line 42, those were variable declarations as well but on the scope of the init() function.
Line 42:
particles, particle;
Playing around a little with that code I realized that the script didn’t work if I declared the particle object on the global scope like that, but it works if i use it like that:
var particle;
And also that ir works well if I remove the line 42.
Why does it work like that? What’s going on?
Thanks
This code has been formatted poorly (imho). It’s not made clear, but:
This is one single
varstatement, with the commas continuing it over lines. This may answer the confusion and help you rearrange declarations.