Avatar

Level 1

What 'm trying to do is to caculate a book pages number for a copying them.

For example I want to copy pages from 25 to 30 , so the user will write 25-30

the number of copies will equal sum = "30 - 25 + 1"

and if the user write only a single number, the number of copies will equal "sum = sum + 1"

So, the user input will be like that "25-30,45-60,65,67"

I'm thinking of using an Array and a "," to split

var sumArray = new Array();

sumArray = sum.split(",");

Are there any possible way to do this ??

Thanx