mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Use new operator to invoke the array.constructor.
This commit is contained in:
@@ -10,7 +10,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
*/
|
||||
function initCloneArray(array) {
|
||||
const length = array.length
|
||||
const result = array.constructor(length)
|
||||
const result = new array.constructor(length)
|
||||
|
||||
// Add properties assigned by `RegExp#exec`.
|
||||
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
||||
|
||||
Reference in New Issue
Block a user