Timeline for Testing if the element is an array, in Javascript
Current License: CC BY-SA 2.5
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 30, 2009 at 7:29 | vote | accept | Andreas Grech | ||
Nov 18, 2009 at 22:30 | history | edited | Russ Cam | CC BY-SA 2.5 |
removed shorthand sample
|
Nov 18, 2009 at 22:29 | comment | added | Russ Cam | You could of course, define a toString function on the constructor's prototype and break the shorthand, so duly noted, will remove the shorthand :) | |
Nov 18, 2009 at 22:28 | comment | added | Crescent Fresh |
@Russ: heh, sorry I think we're just saying the same thing. You're right, jQuery simply does var toString = Object.prototype.toString; . My point was Object.prototype.toString !== window.toString , which invalidates your statement that the second example is equivalent to the first example, that's all :) Cheers.
|
|
Nov 18, 2009 at 22:22 | comment | added | Russ Cam | Doesn't jQuery define it as a local reference to resolve the call quicker? Since all objects derive from Object, they should all have the toString function | |
Nov 18, 2009 at 22:18 | comment | added | Crescent Fresh |
FYI the second example is not a valid shorthand. jQuery creates a local toString reference that simply points to Object.prototype.toString .
|
|
Nov 18, 2009 at 22:06 | history | edited | Russ Cam | CC BY-SA 2.5 |
added 204 characters in body
|
Nov 18, 2009 at 22:00 | history | answered | Russ Cam | CC BY-SA 2.5 |