megi_al

Untitled

Jun 21st, 2021
898
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     Array.prototype.last = function () {
  3.         return this[this.length - 1];
  4.     };
  5.  
  6.     Array.prototype.skip = function (n) {
  7.         return this.slice(n);
  8.     };
  9.  
  10.     Array.prototype.take = function (n) {
  11.         return this.slice(0, n);
  12.     };
  13.  
  14.     Array.prototype.sum = function () {
  15.         return this.reduce((acc, el) => acc + el);
  16.     };
  17.  
  18.    
  19.     Array.prototype.average = function () {
  20.         return this.sum() / this.length;
  21.     };
  22.  
  23. }())
RAW Paste Data