0

Array.from works when returning true

console.log((Array.from(Array(3), (_) => true)))

In reality:

[ true, true, true ]

However, if I want to create a object array, how can I do?

console.log((Array.from(Array(3), (_) => {"a": "b"})))

Excpect:

[{"a": "b"}, {"a": "b"}, {"a": "b"}]

In reality:

';' expected.ts(1005)
TungTung
  • 163
  • 7

0 Answers0