I was trying to get and set the value of a map like an object in JavaScript. I was successfully able to do that. Still I have a doubt whether this is the right way to go about it or will my code break at any point of time?
m = new Map();
Map {}
> m.set('a', 1) //set value
Map { 'a' => 1 }
> m.get('a') //get it
1
> m['b'] = 2 //try using more convenient [] notation
2
> m['b'] //it works!
2
Though this works fine for this particular scenario or other scenarios, is there a scenario where getting a map using m['b'] would fail?