If i want to destruct an Object i would do :
const obj = {
a: 'a',
fn: () => 'some function'
}
// const fn = obj.fn;
// OR
const {
a,
fn
} = obj;
console.log( fn() );
this doesn't work for the Date
Object :
Uncaught TypeError: this is not a Date object.
const date = new Date();
const day = date.getDate();
console.log(day); // works
const {
getDate
} = date;
console.log( getDate() ); // doesn't work
Why is this possible with the first Object and not with the Date
? how would one acheive that if it's possible.