Strings and Floats

I have a slight problem. I am trying to combine Integers with the length of intergers. For example say player 1 score is 1,000. If the player press the a key I want his score to increase by 100. That is simple to do. But If the player press the “s” key I want his score LENGTH to be doubled with extra ZEROS.

For Example. Player score is 1,000

With the “s” key pressed then released

The player score of 1,000 would be 10,000,000 since 8 is the Length of the 1,000 integer doubled with ZEROS. How can I do this with code? I use javascript.

I cannot currently think of any maths-only solution that does not utilise a while loop, hence here is a solution using ToString()

int score;
score *= Mathf.Pow(10, score.ToString().length);

You may wish to write your own integer-only power function as I am not sure of the efficiency of Mathf.Pow.