Get difference between 2 dates in JavaScript

const date1 = new Date('10/15/2020');
const date2 = new Date('12/1/2020');

const diffTime = Math.abs(date2 - date1); // time in milliseconds
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); // convert time to days

Note: Difference in date always return in milliseconds.

How to remember

- 1000 Milliseconds to 1 Sec
- 60 Sec 1 Minute
- 60 Min 1Hr
- 24 Hr to 1 Day

React : Use Single Handler to update all input textbox


    const handleUpdateInput = (e) => {
        let key = e.target.name;
        setEmpData({
            ...empData,
            [key]:e.target.value
        })

    }

7 - ES6 Features

- let & const 
- Arrow Functions
- Template literals
- Default Parameter value 
- Spread and rest 
- destructuring  
   const { name } = person;
- object literals 
    let person = { name } // key and value is same