I'm not able to convert integer of ranged string. I have a age group of 21-30, 31-40,41-50 etc, I have to convert selected string and send to server. I have tried with parseInt method but not working. Below is the code,
var ageSelected = '31-40';
parseInt(ageSelected) //Output is only first number 31 NOT 31-40
Please anybody have idea about this, please help me
-is not an int useparseInt(ageSelected.split('-')[0])for first numberparseInt(ageSelected.split('-')[1])for second number31-40input, since 31-40 is not a valid integer?31-40as an integer because it is not one. If you just have to send this variable as31-40is has to be the string only.