set a previous year to the current date in javascript

Solutions on MaxInterview for set a previous year to the current date in javascript by the best coders in the world

showing results for - "set a previous year to the current date in javascript"
Ian
24 Feb 2019
1const d = new Date();
2d.setFullYear(d.getFullYear()-1);
3
4console.log(d.toDateString()); // "Fri Oct 04 2019"