I was experimenting with the spread syntax and am having difficulty making rational sense out of its behavior in a particular situation.
In one instance, when I use:
const art = ["hello"]
console.log( [{...art}] )
the return value is
=> [ { '0': 'hello' } ]
However, when I iterate over the single array value it produces an entirely different effect:
const art2 = art.map((item) => ({ ...item }))
console.log(art2)
=> [ { '0': 'h', '1': 'e', '2': 'l', '3': 'l', '4': 'o' } ]
Why does using the spread syntax in the first example only combine it with a single index, but in the second example with .map being used break it down into different index elements? Since there is only a single item in the art array I would have assumed the results would be the same.