Slicing an int in js/unityscript?

So, I have a int variable such as

var myuniqueversion = Random.Range(1000, 9000); // come up with a number 4 digits long

How do I store, say digit 2 of this in a new variable?
I’ve tried:

var mydigit : int = myuniqueversion[1];

But this returns an error stating that the int does not support slicing.

If the myuniqueversion generated 1536, I’d be looking for digit 2 of myuniqueversion to be stored in the mydigit int variable, and to be 5 in this case.

You can store the int as a string and then parse it back as an int. Substring can be used to return a specific digit.

var mydigit : int = int.Parse(myuniqueversion.ToString().Substring(1,1));