let details = new Map([
[new Date(),"today"],
[2, {javascript: ["js","node","react"]}]
])
Above is one example where both notations are used.
Object literals {} and [] holds a very important position in Javascript. I am confused with the application of square notations. They are also used in JSON and also object literals are used in JSON.
Those who are experienced today would have gone through the same confusion during their evolution. How to understand everything about these two brackets in JS to apply them with clarity every time.
As far as I understand square bracket notation represents a string.
also things that would otherwise be invalid in dot notation but are valid property name identifiers - spaces, symbols,leading numbers, expressions, etc.