[jQuery] Re: What does === equate to?

2007-08-02 Thread Sam Collett
I don't think many actually use !== (and when you would want to use it) and many sites that show usage of operators don't cover !== (but do have ===). 3 != '3' false 3 !== '3'true 3 == '3' true 3 === '3'false On Aug 1, 9:33 pm, Michael Geary [EMAIL PROTECTED] wrote:

[jQuery] Re: What does === equate to?

2007-08-02 Thread Rob Desbois
I had a discussion on the use of the === and !== operators recently on this list, my opinion was, and still is, that unless you explicitly WANT to allow type conversion, you should be using these. Only use == and != if you really want type conversion. It's bitten me once, although I can't for the

[jQuery] Re: What does === equate to?

2007-08-02 Thread Ian Struble
!== and === are identity operators. It is a good idea to use them instead of the equality operators (!= and ==) unless you know why you would want to use equality (and the possible type coercion) over identity. Probably the biggest gotcha with equality is with falsy values (false, 0, undefined,

[jQuery] Re: What does === equate to?

2007-08-02 Thread Terry B
known about this for awhile but since we are on the topic... there has to be some over head of using == and != does anyone know for sure the impact of the overhead... and does it matter of the type On Aug 2, 6:21 am, Ian Struble [EMAIL PROTECTED] wrote: !== and === are identity

[jQuery] Re: What does === equate to?

2007-08-02 Thread Rob Desbois
There's no overhead unless the types are different. From the ECMAScript specification: For the 'abstract equality comparison algorithm' (==) [11.9.3] 1. if Type(x) is different from Type(y), go to step 14. For the 'strict equality comparison algorithm' (===) [11.9.3] 1. if Type(x) is different

[jQuery] Re: What does === equate to?

2007-08-02 Thread Michael Geary
That's an interesting find, Rob, thanks. But watch out. We're looking at the ECMAScript standard, not running code. An actual implementation could have different performance for the two operators and still conform to the spec. It does seem unlikely that anyone would code == to be slower than ===

[jQuery] Re: What does === equate to?

2007-08-01 Thread Jake McGraw
The triple equals is a comparison without type conversion. The following should fix your code so that fn.apply() never runs with fn is null: if (fnfn.apply(...)) break; The first part checks if fn is non-null, if it is null or false or 0 or Nan the second part fn.apply will never run and you

[jQuery] Re: What does === equate to?

2007-08-01 Thread Michael Geary
I...cannot figure how what the heck === is. I see that Jake answered your question, but just for next time... You may have tried a Google search for javascript === and been disappointed to find it returned no useful results (because Google seems to ignore the === in the search). The key thing

[jQuery] Re: What does === equate to?

2007-08-01 Thread Michael Geary
Wow, that *is* funny. I must confess that I didn't actually look at the search results! _ From: Ganeshji Marwaha funny, both w3schools and javascriotkit (top 2 results for the query javascript+operators) doesnt seem to have an explanation for !==. ;-) On 8/1/07, Michael Geary [EMAIL

[jQuery] Re: What does === equate to?

2007-08-01 Thread Ganeshji Marwaha
funny, both w3schools and javascriotkit (top 2 results for the query javascript+operators) doesnt seem to have an explanation for !==. ;-) -GTG On 8/1/07, Michael Geary [EMAIL PROTECTED] wrote: I...cannot figure how what the heck === is. I see that Jake answered your question, but just for