From 17674e201fc70cf9ba90cce1d58d1d0a74adb63d Mon Sep 17 00:00:00 2001 From: Shaban-Eissa Date: Fri, 7 Jun 2024 19:04:32 +0300 Subject: [PATCH] Update 151.implement-Array-prototype-map.md --- 151.implement-Array-prototype-map.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/151.implement-Array-prototype-map.md b/151.implement-Array-prototype-map.md index 49da932..d05af0f 100644 --- a/151.implement-Array-prototype-map.md +++ b/151.implement-Array-prototype-map.md @@ -70,7 +70,7 @@ This JavaScript code is a custom implementation of the `Array.prototype.map()`fu Here's a breakdown of the code: -1. `Array.prototype.myMap = function (callback, thisArg) {...}` This line is extending the Array prototype with a new method called `myMap`. This method takes two arguments: a `callback` function and an optional `thisArg` object that will be used as `this`] when executing the callback. +1. `Array.prototype.myMap = function (callback, thisArg) {...}` This line is extending the Array prototype with a new method called `myMap`. This method takes two arguments: a `callback` function and an optional `thisArg` object that will be used as `this` when executing the callback. 2. `const length = this.length;`: This line is storing the length of the array on which `myMap` was called. This is done to avoid potential infinite loops if the array's length is changed during the execution of `myMap`.