Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- Array.prototype.last = function () {
- return this[this.length - 1];
- };
- Array.prototype.skip = function (n) {
- return this.slice(n);
- };
- Array.prototype.take = function (n) {
- return this.slice(0, n);
- };
- Array.prototype.sum = function () {
- return this.reduce((acc, el) => acc + el);
- };
- Array.prototype.average = function () {
- return this.sum() / this.length;
- };
- }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement