I need to get an array of distinct strings from a map, extracting the string from a property of the Map's values. At the moment, I have the following code and was wondering if there was a more elegant way to do it?
myMap   {   key1 : [{ a : “myA”, b : “myB”, c : “myC”}, {  a : “myAA”, b : “myB”, c : “myC”}],
            key2 : [{ a : “myAA”, b : “myB”, c : “myC”}, {  a : “myAAA”, b : “myB”, c : “myC”}]
        }
Ans needed = ["myA", "myAA", "myAAA"]
var ans = new Set();
for (let i of myMap.values()) {
    for (let j of i){
        ans.add(j.a);
    }
}
return Array.from(ans);
 
    