| class Item { | |
| #cache = null; | |
| constructor(i) { | |
| this.id = i; | |
| this.name = "item" + i; | |
| this.price = i + 0.5; | |
| } | |
| get cache() { return this.#cache; } | |
| } | |
| let items = []; | |
| for (let i = 0; i < 100; ++i) | |
| items.push(new Item(i)); | |
| let expected = "[" + items.map(item => `{"id":${item.id},"name":"${item.name}","price":${item.price}}`).join(",") + "]"; | |
| let result; | |
| for (let i = 0; i < 2e4; ++i) | |
| result = JSON.stringify(items); | |
| if (result !== expected) | |
| throw new Error("bad"); |