-1

I am trying to add a number to an array .

code:

var year = mm[2].value+1;

but it results undefined.

can you guys how to do this?

1 Answers1

1

You need to parse the string to an integer before you add to it:

var dt = "12/02/2012"; 
var mm = de.split("/"); 
var year = parseInt(mm[2])+1;
Asad Saeeduddin
  • 46,193
  • 6
  • 90
  • 139