let x = new Date();
if (x instanceof Date) {
// will execute
}
let x = new Date();
if (Object.prototype.toString.call(x) === "[object Date]") {
// will execute
}
let x = new Date("Bad String");
if (x instanceof Date) {
// executes, because `x` is technically a date object
}
if (x instanceof Date && !isNaN(x)) {
// will not execute
}