let m = new Map();
let obj = {};
let keyString = 'a string';
let keyObj = {};
let keyFunc = function() {};
obj[keyObj] = 'object inside object as keys!';
obj[keyFunc] = function() {}
m.set(keyObj, 'object');
m.set(keyFunc, 'function');
console.log(typeof obj[keyObj]); // type = string
console.log(typeof obj[keyFunc]); // type = function
console.log(typeof m.get(keyObj)); // type = string
console.log(typeof m.get(keyFunc)); // type = string
console.log(m.get(keyObj)) // object
console.log(m.get(keyFunc)) // function
Then what is difference between map and object? map also converts the keys type to string.