Difference between objects with date in JavaScript

In the previous lessons, we used the timestamp format to find the difference between dates. However, this is not really necessary in JavaScript: dates represented as a Date object can be subtracted from each other, and the result of their subtraction is the difference in milliseconds.

For example, let's print the number of milliseconds that have passed since May 25, 2015, 12:59:59 until now:

javascriptlet now  = new Date();
let date = new Date(2015, 4, 25, 12, 59, 59);

let diff = now - date; // subtracts two objects with dates from each other
console.log(diff);     // shows the difference in milliseconds
Задание 1

Print the number of milliseconds elapsed between September 1, 2000 and February 15, 2010.

Задание 2

Modify the previous task to display the difference in days.

Задание 3

Modify the previous task to display the difference in months.

Задание 4

Modify the previous task to display the difference in years.