JSFiddle - React, Tailwind, and code Playground

by KevinABoucher

JavaScript

var obj = {
    a: undefined,
    b: null,
    c: false
};

if(obj.hasOwnProperty('a')) {
	console.log("has a");
}

if(obj.hasOwnProperty('b') && obj['b'] !== null) {
	console.log("has b");
}

if(obj.hasOwnProperty('c')) {
	console.log("has c");
}

if(obj.hasOwnProperty('d')) {
	console.log("has d");
}