/ Published in: JavaScript

Guess the type of any object applying ducktyping
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function type(o){return o.call?"function":o.pop?"array":o instanceof Boolean?"boolean":+o==o?"number":o.charAt?"string":o.toString()=="[object Object]"?"object":"undefined"}
URL: http://www.twitter.com/pablo_PXL
Comments
