My array,
var array = [[{'text':'alk'},{'text':'ank'}],[{'text':'nmk'},{'text':'jlk'}],[{'text':'mml'},{'text':'hhj'}],[{'text':'nnl'}]]
I want to write all this data into file each array of array into one file.
file 1 has [{'text':'alk'},{'text':'ank'}],[{'text':'nmk'},{'text':'jlk'} data
file 2 has {'text':'mml'},{'text':'hhj'}
file 3 has {'text':'nnl'}
I wrote the code as,
arrays.forEach(function(i,v){
v = v+1;
var newData ='saved';
fileName = 'public/amp/test2/amp-blogs-list-page'+v+'.html';
i.forEach(function(k,l){
filewrite goes here
});
});
I see only the last item af each arry is written into the file,Can anyone please help me.Thanks.