From what I've learned, javascript allows any type to a value of an key inside an object like:
{
  key1: "string",
  key2: ["list"],
  key3: 123,
  key4: { name: "string embedded in an object in another object"}
}
But it only allows certain certain types for the keys like string and integers: { "string": "string", 123: "integer" }
I came across this when I wrote the below code this and the key ended up being:  [object Object]
let a = {}
let b = {}
b.name = {name: "name"}
a[b.name] = "value"
console.log(JSON.stringify(a))
Result from above:
{"[object Object]":"value"}
So what types are allowed for keys in objects in js?? And why does it show the key as [object Object]?
 
     
     
    