Reproduce code
import { _decorator, Component, Node } from "cc";
const { ccclass, property } = _decorator;
@ccclass("MainScene")
export class MainScene extends Component {
protected onLoad(): void {
const map = new Map([
["key1", "value1"],
["key2", "value2"],
]);
const values = [...map.values()];
for (const v of values) {
console.log(v);
}
}
}
The above code can output the results normally in the preview environment:
But after choosing web-desktop build, the output becomes: