const xmas = new Date("1995-12-25");
const year = xmas.getYear(); // returns 95Date.prototype.getYear() / notebook
Date.prototype.getYear()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const xmas = new Date("2000-12-25");
const year = xmas.getYear(); // returns 100const xmas = new Date("1800-12-25");
const year = xmas.getYear(); // returns -100const xmas = new Date("2015-12-25");
xmas.setYear(95);
const year = xmas.getYear(); // returns 95