Еще вариант
const checkPath = (obj, path) => {
let keys = path.split('.'), key;
while (keys.length) {
key = keys.shift();
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
return false;
}
obj = obj[key];
}
return true;
};
let path = 'props.header.slogan',
obj = {props: {header: {slogan: undefined}}};
console.log(checkPath(obj, path));