Javascript get current year code example

Example 1: Javascript get current year

var currentYear= new Date().getFullYear();

Example 2: how to get the year in javascript

new Date().getFullYear(); // This will get you the current year

Example 3: how to get current year in nodejs

const todaysDate = new Date()
const currentYear = todaysDate.getFullYear()
// 2020

Example 4: get year from date javascript

document.write(new Date().getFullYear());

Example 5: javascript get current year

var currentYear= new Date().getFullYear();

Example 6: Javascript get current year

const currentYear = todaysDate.getFullYear()

Tags:

Misc Example