2259-remove-digit-from-number-to-maximize-result

DevGod needs to write a blog entry for this problem!
/**
 * @param {string} number
 * @param {character} digit
 * @return {string}
 */
var removeDigit = function(number, digit) {
    let arr = [];

    for(let I = 0; I < number.length; I++){
        if(number[I] == digit){
            let newStr = number.substring(0,I)+number.substring(I+1);
            arr.push(newStr);
        }
    }

    arr.sort();
    return arr[arr.length-1]
};