Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

instanceof considered harmful (or how to write a robust isArray. JavaScript’s instanceof operator breaks when dealing with objects that may have been created in a different document or frame, since constructors are unique to each frame. Instead, you can check for arrays using the default Object.toString method which the JS spec guarantees will return [object Array].

Tagged , , , , ,

0 comments

No comments.

Comments are closed.
A django site