component.get("Attr")
generally gives undefined
if the attribute is not present. It doesn't throw an exception.
In JavaScript, the standard way to catch null and undefined simultaneously is this:
if (typeof component.get("Attr") != 'undefined' && component.get("Attr")) {
console.log("Happy");
}else{
console.log("Sad");
}