Skip to content
loading...

re: Latest thing I learned about Object and friends VIEW POST

TOP OF THREAD FULL DISCUSSION
re: NANI?!? Okay, I'm puzzled here. It seems like objects are functions. And in a certain sense, they are... The key is the argument and the value is ...
 

Whoa...

> f = k => k*2
[Function: f]
> f.keys = k => k.v
[Function (anonymous)]
> f.keys()
Thrown:
TypeError: Cannot read property 'v' of undefined
    at Function.f.keys (repl:1:17)

Function.f.keys?!? But when I did this with Object, it was just Function.keys, not Function.Object.keys.

On that note:

> Object.keys
[Function: keys]

This would seem to imply that keys exists in the global scope, which it doesn't. When I tried this on f.keys it was "[Function: (anonymous)]".

JavaScript is really weird...
But there is one more question:
Then what does

a = {}
b = {Key: "value", foo: "bar"}

do? Is there any equivalent in plain JS?
There is still so much more we need to know...
But good investigations so far, I'm also working on this as well!

code of conduct - report abuse