

The this value ultimately observable by callbackFn is determined according to the usual rules: if callbackFn is non-strict, primitive this values are wrapped into objects, and undefined/ null is substituted with globalThis. The thisArg argument (defaults to undefined) will be used as the this value when calling callbackFn.

What callbackFn is expected to return depends on the array method that was called. The array that the method was called upon. The index of the current element being processed in the array. The current element being processed in the array. Where callbackFn takes three arguments: element The following methods mutate the original array: Conceptually, they are not copying methods either. Note that group() and groupToMap() do not use to create new arrays for each group entry, but always use the plain Array constructor. splice() (to construct the array of removed elements that's returned).The following methods create new arrays with concat() Other methods mutate the array that the method was called on, in which case their return value differs depending on the method: sometimes a reference to the same array, sometimes the length of the new array. Primitive types such as strings, numbers and booleans (not String, Number, and Boolean objects): their values are copied into the new array.

That is, if a referenced object is modified, the changes are visible to both the new and original arrays. Both the original and new array refer to the same object.
