I want to print something on the excel file and that excel file works on the format of array of arrays so I need to convert an array into an array of arrays like this:
['x','y','z'] to [['x'],['y'],['z']]
I have tried to use store this using the firestore and push it on the array
const query = async() => {
const querySnapshot = await db.collection('collectionName').get();
const data = []
querysnapshot.forEach(doc => {
const x = getIdentifier(doc)
data.push(x)
})
console.log(data) //it gives an array like this ['x','y','z']
}
query();
console .log (data .map (x => [x]))should be all you need.['x','y','z'] to [['x'],['y'],['z']]why are you adding information about firebase?const data = querysnapshot .map (getIdentifier)(assuming thatquerysnapshotis simply an array.)querysnapshot.map((data) => getIdentifier(data)).