1Object.defineProperty(Array.prototype, "lastValue", 2{ 3 get: function() 4 { 5 if (!this.length) 6 return undefined; 7 return this[this.length - 1]; 8 } 9}); 10