Reputation: 441
i want to replace month name by number in array, but my script doesnt work.
for(i=0; i<a.length; i++) {
arr = arr.replace(/Jan/g, "01");
}
Can somebody help me please?
Upvotes: 1
Views: 242
Reputation: 3844
Try this:
for(i=0; i<a.length; i++) {
arr[i] = arr[i].replace(/Jan/gi, "01");
}
Also... Shouldn't the line be:
for(i=0; i < arr.length; i++) {
Upvotes: 1