lucas.lmlok

Results 5 comments of lucas.lmlok

```js Promise.retry = (promiseFn, tries = 3) => { return new Promise(async (resolve, reject) => { while (tries > 0) { tries--; try { const result = await promiseFn(); resolve(result);...

```js Array.prototype._indexOf = function (searchElement, fromIndex = 0) { if (typeof fromIndex !== 'number') { fromIndex = 0; } if (fromIndex < 0) { fromIndex += this.length; } for (let...

```js Array.prototype._splice = function (start, deleteCount, ...items) { if (start < 0) { start += this.length; } start = Math.max(start, 0); if (deleteCount === 'undefined') { deleteCount = this.length -...

```js const list = [1, 2, 3]; const square = (num) => { return new Promise((resolve, reject) => { setTimeout(() => { resolve(num * num); }, 1000); }); }; async...

```js Object.prototype.map = function (callbackFn) { if (typeof callbackFn === 'undefined') { throw new TypeError(`${callbackFn} is not a function`); } const res = {}; Object.entries(this).forEach(([key, value]) => { res[key] =...