Well, you probably saw the code in my jsfiddle, right. Some person said I should instead use Object.assign, like so:
const explosions = Object.assign([], {
pool : [],
create() {
var exp;
if (explosions.pool.length) {
exp = explosions.pool.pop();
} else {
exp = new Explosion();
}
explosions.push(exp);
return exp;
},
update() {
var i;
for (i = 0; i < explosions.length; i ++) {
if (explosions[i].update() === false) {
explosions.pool.push(explosions.splice(i--, 1)[0]);
}
}
},
});