Hello I'm new student in js, I'm trying to use split in output[2] so i can take the Month's number dd-mm-YYYY and using push to a new array to save em with a new name of months (str ?) .
ex: 21/05/1989 with a new name of month in a new array : May
var output = [
[ '0001', '0002', '0003', '0004' ],
[ 'Roman Alamsyah', 'Dika Sembiring', 'Winona', 'Bintang Senjaya' ],
[ '21/05/1989', '10/10/1992', '25/12/1965', '13/9/1994', '10/8/1994', '19/7/1994' ],
] ;
function mixarray(){
var months =[]; //probably wrong should just push to new array in output ?
//months.push([]);
//console.log(output[2].length);
for(var i = 0; i < output.length ;i ++){
// console.log(output[i]);
for(var j=0 ; j< output[i].length; j++){
months = output[i][j].split("/");
}
}
console.log(months);
}
mixarray(output);
I did some split but somehow my brain crashed after trying to push em to new array and combine it with month's name(probably using if-else for month's name huh ?)
it might better to push in new-array in output
so it will show like this later with sorted ( i can do the sort later ) :
Months:
August,Dec,July,May,Oct,Sept
I just need to know how this months be able to push into a new array :
['May','Oct','Dec','Sept','August','July'];
from this :
[ '21/05/1989', '10/10/1992', '25/12/1965', '13/9/1994', '10/8/1994', '19/7/1994' ]
monthsin every iteration of the loop when you usemonths =. End result will bemonthsis the same as the split in last iteration