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?
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?
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;