Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not even very useful is it? shouldn't there be another check for !(Array.isArray(x)) ? Otherwise, checking for isObject(foo) will still not guarantee that foo.bar won't fail.


    var foo = [1, 2, 3, 4];
    foo.bar = "I exist";
    console.log(foo.bar);
    foo.baz = function() { return "So do I"; }
    console.log(foo.baz());
Arrays are, to most practical purposes, just special objects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: