var with more than one variable brings down app
I have a couple of "var" declarations with multiple variables per line in a JS file, as in
var lmargin, tmargin, winHeight, winWidth, params
This immediately crashes NS4, but works fine in everything else. I thought this was acceptable and a way to save a little bandwidth, but I guess not. If I change it to
It works just fine. It took me so long to figure it out I just had to share!
I've never had a problem with that. Even NS2 never had difficulty with var, although it had difficulty with just about anything else.
Actually, the var declaration was in a function and was intended to keep the scope local. What's weird is that it doesn't create errors on the page or anything like that, it literally crashes the application and it has to be restarted, and that's true even with NS on Irix.
Once I put one variable per var statement, no problems.
I can't remember if I've ever done that inside a function body. It's a strange bug, and I've never seen it documented anywhere...
Thanks. I'm not a JS person at all (though I knew I *should* do that in JS). Anyway, my JS needs a lot of optimization, but I was just trying to get it from crashing NS first. This is NS4.5, byt hte way. I haven't tested it with other 4.x versions.