I'm seeing the following behaviour, in the middle of a javascript debug session:
o // function (a1, a2, a3) { return a1 + a2 + a3; }
typeof(o) //'function'
for (var n in o) { console.log(n); } //<a list of properties>
Object.keys(o) //TypeError: not an object
Object.prototype.toString.call(o); //"[object Function]"
which makes me wonder - can a function, ever not be object?
[running on Chrome 29, on a mac]
Note that this is in the middle of a very complex debug session. I don't exactly know where 'o' is coming from, or how it was created. Also, I've so far been unable to reproduce this issue with a simple test case. A simple setup works as expected:
var t = function() { return true; } //undefined
t.a = "aa" //"aa"
Object.keys(t) //["a"]