3 ms·
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
by m_mueller 12y ago
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.
- ajanuary 12y agovar 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.