5
var secondHighest = function (s) {6
//let's start by getting rid of all the non-digits8
s = s.replace(myRegex, "");9
var digits = s.split("");10
//at this point, digits is an array of all the digit characters that were originally in s11
digits.sort(function (a, b) {13
}); //sort the array into descending order14
var res = new Set(digits); //turn the array into a set, to remove duplicates16
//if the set is sized 1, then there is no second largest digit19
//otherwise, the second largest digit would be at index 1 (because we sorted the array into descending order)