I have a JavaScript string which consists of two numbers separated by a /
.
I want to be able to separately be able to get each of the numbers.
When there are only 1 digit integers, I can get the values pretty easily, but I don't know what to do when there are two digits integers.
Single Digits:
var string = "5/9";
var firstVal = string.slice(0, 1);
var secondVal = string.slice(-1);
Multiple Digits Variations:
var string = "10/23";
var string = "9/21";
var string = "45/2";