JSFiddle - React, Tailwind, and code Playground

by Alexey

JavaScript

if (!Date.prototype.lastYear) {
  Date.prototype.lastYear = function() {
    return new Date(this).getFullYear() - 1;
  }
}

let a = new Date('2007-11-11').lastYear();
//console.log(a)


Array.prototype.map = function() {
let x = this;

return this;
}


console.log([1,2,3,4,5].map());