var with more than one variable brings down app
| 7:00 pm on Jul 11, 2002 (gmt 0)|
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!
| 6:11 pm on Jul 12, 2002 (gmt 0)|
I've never had a problem with that. Even NS2 never had difficulty with var, although it had difficulty with just about anything else.
| 10:39 pm on Jul 12, 2002 (gmt 0)|
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.
| 7:18 am on Jul 13, 2002 (gmt 0)|
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...
| 2:06 pm on Jul 13, 2002 (gmt 0)|
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.