Given an object anObject and a key aKey, returns a boolean telling is this object effectively possesses this key as an attribute (in this function, objects are considered as a set of key-value pairs).
anObject
aKey
the object to consider
the key inside the object
if anObject possesses a value associated to aKey
hasKey({ x: 1 }, "y"); // -> falsehasKey({ y: 1 }, "y"); // -> true Copy
hasKey({ x: 1 }, "y"); // -> falsehasKey({ y: 1 }, "y"); // -> true
Given an object
anObject
and a keyaKey
, returns a boolean telling is this object effectively possesses this key as an attribute (in this function, objects are considered as a set of key-value pairs).