How can I group strings by longest shared ending substring in JavaScript?
I have a strange problem. I am trying to write code that groups strings that end with the longest same substring. For example, I have a collection of strings: ["samsung.phone.com", "lg.phone.com", "phone.com", "camera.dsrl.nikon.com", "amd.gpu.com", "intel.cpu.com" ] I want to create…