Is this your company?
Taking an array of strings, return an array with the first instance of any string whose anagram is later in the array (preserving order, removing the later anagram instances and any strings without anagrams)
Anonymous
let result = []; const AnagramFinder = () => { s.forEach((word, index) => { let sorted = word .split("") .sort() .join(""); if (!result.includes(sorted)) { result.push(sorted); } }); return result; };
Check out your Company Bowl for anonymous work chats.