1 | "use strict";
|
2 | String.prototype.capitalize = function () {
|
3 | return this.charAt(0).toUpperCase() + this.slice(1);
|
4 | };
|
5 | Array.prototype.insert = function (index, items) {
|
6 | for (let i = index; i < index + items.length; i++) {
|
7 | this[i] = items[i - index];
|
8 | }
|
9 | return this;
|
10 | };
|
11 | Array.prototype.remove = function (o) {
|
12 | const index = this.indexOf(o);
|
13 | if (index === -1)
|
14 | return this;
|
15 | this.splice(index, 1);
|
16 | return this;
|
17 | };
|
18 | Array.prototype.random = function () {
|
19 | return this[Math.floor(Math.random() * this.length)];
|
20 | };
|
21 |
|
\ | No newline at end of file |