Prev: FireFoc support forums (Re: FF3.6 Stack output from Too MuchRecursion)
Next: PASSING VALUES BETWEEN SCRIPTS
From: David Mark on 13 Mar 2010 12:44 Stefan Weiss wrote: > On 10/03/10 17:35, Lasse Reichstein Nielsen wrote: >> SAM <stephanemoriaux.NoAdmin(a)wanadoo.fr.invalid> writes: >>> My Firefox tells me 'undefined' for all that alerts : >>> >>> var b = [1,2,,4,5]; >>> alert(b[2]); >> Yes, reading a non-existing property yields the undefined value. >> This is no different from doing: >> var x = new Object(); >> alert(x.arglebargle); >> The object x has the property "arglebargle", so trying to read >> it yields undefined. > > Aside, because it just came up on the JSLint mailing list: when strict > warnings are enabled in Firefox, trying to access x.arglebarle will > trigger a warning, but accessing a nonexistent array index will not. I'm > not sure if that's very logical or consistent. > That's one of the things I don't like about FF strict mode. if (myObject.myProperty) { // Not there, so what? Perhaps create it. } What do they want you to do? Use typeof? I haven't used that thing in ages. Is there a way to filter such spurious warnings so you can see real problems? If not, it's useless in my book.
From: "Michael Haufe ("TNO")" on 13 Mar 2010 17:53 On Mar 13, 11:44 am, David Mark <dmark.cins...(a)gmail.com> wrote: > That's one of the things I don't like about FF strict mode. > > if (myObject.myProperty) { > // Not there, so what? Perhaps create it. > > } > > What do they want you to do? Use typeof? > > I haven't used that thing in ages. Is there a way to filter such > spurious warnings so you can see real problems? If not, it's useless in > my book. A warning won't be thrown if you're referencing an undefined property in an if. The warning will be thrown if its used in other places, which I think is understandable: var x = {}; if(x.arglebargle){ //no warning is thrown } //////////////////////// var x = {}; alert(x.arglebargle); //warning thrown //////////////////////// var x = {}; function foo(x){} foo(x.arglebargle); //warning thrown I don't see where the complaint would be.
From: "Michael Haufe ("TNO")" on 13 Mar 2010 17:55 On Mar 13, 4:53 pm, "Michael Haufe (\"TNO\")" <t...(a)thenewobjective.com> wrote: > A warning won't be thrown if you're referencing an undefined property > in an if. The warning will be thrown if its used in other places, s/in an if/in an if statement
From: David Mark on 13 Mar 2010 18:15 Michael Haufe ("TNO") wrote: > On Mar 13, 11:44 am, David Mark <dmark.cins...(a)gmail.com> wrote: > >> That's one of the things I don't like about FF strict mode. >> >> if (myObject.myProperty) { >> // Not there, so what? Perhaps create it. >> >> } >> >> What do they want you to do? Use typeof? >> >> I haven't used that thing in ages. Is there a way to filter such >> spurious warnings so you can see real problems? If not, it's useless in >> my book. > > A warning won't be thrown if you're referencing an undefined property > in an if. The warning will be thrown if its used in other places, > which I think is understandable: > > var x = {}; > if(x.arglebargle){ > //no warning is thrown > } > //////////////////////// > var x = {}; > alert(x.arglebargle); //warning thrown > //////////////////////// > var x = {}; > function foo(x){} > foo(x.arglebargle); //warning thrown > > > I don't see where the complaint would be. Probably in my faulty memory. As mentioned, I haven't used the thing in ages. I know there was something it did that I didn't like though.
First
|
Prev
|
Pages: 1 2 3 4 5 Prev: FireFoc support forums (Re: FF3.6 Stack output from Too MuchRecursion) Next: PASSING VALUES BETWEEN SCRIPTS |