Using new Date() object we can get current year. 

Steps:

Get current date-time using new Date() object.

Get year from the object using getFullYear().

Example Code:

let date = new Date();

let year = date.getFullYear();

console.log(year);

Example Output:

2021