Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试向数组添加一个数字。
代码:
var year = mm[2].value+1;
但结果未定义。
你们能怎么做吗?
在添加之前,您需要将字符串解析为整数:
var dt = "12/02/2012"; var mm = de.split("/"); var year = parseInt(mm[2])+1;