i would like to compare two link and know their the top-level domain are the same. This is required by Google AdWords because the final url and the ad url shown may have the same top-level domain.
For example i need
link1 = 'adwords.google.com';
link2 = 'www.google.com';
if(compare(link1,link2)){
console.log('OK');
}
how can I write the function compare()?