Message from JavaScript discussions

December 2018

— True

— 

const hasKey = (obj, key) =>
Object
.prototype
.hasOwnProperty
.call(obj, key);

if (hasKey(obj, key)) {

— This is okay

— Const has = Object.prototype.hasOwnProperty; // cache the lookup once, in module scope.

— Do you guys prefer the prototype chain over the class syntax?

— So you have to do:
if (has.call(obj, key)) {
?

— Seems worse

— Yep

— Thats airbnbs first choice

— const hop = Object
.prototype
.hasOwnProperty;

const has = (obj, key) =>
hop.call(obj, key);

if (has(obj, key)) {

Message permanent page

— Cached AND looks good

— Sooo if i use if(obj.key) and the obj is null... its the same error isnt it?