Tripple equals comparision and array length in js?

Obj. Length will return a numerical value. === compares the type of the objects and their values.In other words it performs a strict comparison geekswithblogs.net/brians/archive/2010/0....

Obj. Length will return a numerical value. === compares the type of the objects and their values.In other words it performs a strict comparison.

geekswithblogs.net/brians/archive/2010/0....

Ok, I understand that lines checks if object has property length, and if this property has numerical value. Thus, why typeof operator wasn't used here? Ie.

Typeof obj. Length === 'number'? – Marcin Pietraszek Oct 11 at 9:29.

This line: else if (obj. Length === +obj. Length) { is necessary because typeof will return object.

The resolution of valueOf can be somewhat involved, bouncing between functions exposed in JS and internal engine stuff. Suffice to say that the comparison will always end up with two values coerced to primitive or an error will be thrown. Edit: EQUALS actually tries STRICT_EQUALS first which preempts the rest of the process.

The interesting bit here is that valueOf (and its partner toString) are overridable. Run this piece of code in Chrome (I think any webkit, not sure if JSC and V8 share this tidbit). The essence of the difference between == and === is illustrated by === not showing up in that list.

It skips the journey into JavascriptLand entirely.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions