fix: wrong return value from array.push and array.unshift

This commit is contained in:
TopchetoEU 2025-01-09 00:07:17 +02:00
parent 4ea14ca1f5
commit fde8b42e36
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -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;