I was telling to a colleage in work that [1].map(e => {attr:e});
will not do what he thinks. He was thinking that the return will be [{attr: 1}]
.
I though that node will crash with this code, but for my surprise, when I open the node program in the terminal, if I write that line is not crashing, is returning [undefined]
in node 8. And if I write a = "b"; hello:a
it returns "b"
.
What is happening there?