Javascript Data Type Checker Is Date

Description

Javascript Data Type Checker Is Date



// Checks to see if something is a date
Object.isDate = function(obj) {
    // test to see if it is an object and its constructor is a date
    return (typeof obj == 'object' && obj.constructor == Date)
}

let a = new Date();

console.log(Object.isDate(a));// ww  w. ja v  a 2 s.c om



PreviousNext

Related