minecraft-debugger icon indicating copy to clipboard operation
minecraft-debugger copied to clipboard

Object.entries(object).forEach breaks the debugger

Open mrpatches123 opened this issue 2 years ago • 2 comments

code

const object = { help: 8, heloo: 9, hejkekj: 8 };
Object.entries(object).forEach(([key, value]) => {
	console.warn(JSON.stringify({ [key]: value }));
});

error: Failed to get stack trace for undefined at line undefined.

in-game the code works fine

mrpatches123 avatar Nov 26 '22 17:11 mrpatches123

this bug also occurs on any array methods with callbacks

code to test:

const array = [0, 1, 2, 3]; // Set breakpoint here

array.map((el) => {
	if (typeof el === "number") return el;
});

array.filter((e) => typeof e === "number");

array.forEach((e) => {
	e++;
});

array.find((e) => {
	if (e.toFixed) return e;
});

debugger console output: photo vscode error popup: photo

leaftail1880 avatar Nov 26 '22 19:11 leaftail1880

What's weird is callbacks in custom functions (prototypes) do not throw but only native array ones.

mrpatches123 avatar Nov 29 '22 15:11 mrpatches123