1 var list = document.getElementsByTagName(‘h3‘); 2 var arr = [] 3 for (var i = 0; i < list.length; i++) { 4 var txt = list[i].innerText 5 arr.push(txt) 6 } 7 for (var j = 0; j < arr.length - 1; j++) { 8 for (var i = 0; i < arr.length - 1 - j; i++) { // 0 length-2 9 if (arr[i].length > arr[i + 1].length) { 10 var temp = arr[i]; 11 arr[i] = arr[i + 1]; 12 arr[i + 1] = temp; 13 } 14 } 15 } 16 var arr1 = arr.reverse() 17 var arr2 = [] 18 for (let i = 0; i < 3; i++) { 19 for (let j = 0; j < list.length; j++) { 20 if (list[j].innerText == arr1[i]) 21 arr2.push(j) 22 } 23 } 24 for (var i = 0; i < arr2.length; i++) { 25 console.log(list[arr2[i]].innerText) 26 var url = list[arr2[i]].getElementsByTagName(‘a‘); 27 console.log(url[0].href); 28 }