In Python, I can do: l = [{'d': 3}] * 5
to get [{'d': 3}, {'d': 3}, {'d': 3}, {'d': 3}, {'d': 3}]
.
What is the equivalent way of doing this in ES6, that actually clones the objects and not just copying the reference?
edit: Basically, is there a shortcut in ES6 to make the following array:
const arr = [
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
{"d": 3},
];
?