fix: wrong return value from array.push and array.unshift
This commit is contained in:
parent
4ea14ca1f5
commit
fde8b42e36
@ -33,7 +33,7 @@ export const Array = (() => {
|
|||||||
for (let i = arguments.length - 1; i >= 0; i--) {
|
for (let i = arguments.length - 1; i >= 0; i--) {
|
||||||
this[start + i] = arguments[i];
|
this[start + i] = arguments[i];
|
||||||
}
|
}
|
||||||
return arguments.length;
|
return this.length;
|
||||||
}
|
}
|
||||||
public pop(this: any[]) {
|
public pop(this: any[]) {
|
||||||
if (this.length === 0) return undefined;
|
if (this.length === 0) return undefined;
|
||||||
@ -51,7 +51,7 @@ export const Array = (() => {
|
|||||||
for (let i = 0; i < arguments.length; i++) {
|
for (let i = 0; i < arguments.length; i++) {
|
||||||
this[i] = arguments[i];
|
this[i] = arguments[i];
|
||||||
}
|
}
|
||||||
return arguments.length;
|
return this.length;
|
||||||
}
|
}
|
||||||
public shift(this: any[]) {
|
public shift(this: any[]) {
|
||||||
if (this.length === 0) return undefined;
|
if (this.length === 0) return undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user