how to get the year in javascript

JavaScript
var currentYear= new Date().getFullYear(); new Date().getFullYear(); // This will get you the current yeardocument.write(new Date().getFullYear());
Source

Also in JavaScript: