[Solved] How can I create a method of finding the total number of possible combinations using a dynamic format [closed]


I being a number, there is 10 possibilities.

S being a character, there is 26 possibilities.

The total number of combinations is 10 power (TheNumberOfI) * 26 power (TheNumberOfS)

This can be dynamically solved using a simple function that counts the number of S and the number of I and uses the results in the previous equation

function getNumberOfCombinations(input)
{
    const countI = (input.match(/I/g) || []).length;
    const countS = (input.match(/S/g) || []).length;
    const result =  Math.pow(10, countI) * Math.pow(26, countS);
    return (result);
}

console.log(getNumberOfCombinations("ISSIIIISS"));

1

solved How can I create a method of finding the total number of possible combinations using a dynamic format [closed]