I want to get rid of javascript array

Advertisements

This is the react library environment.
After using the map function on the array, I put it in the minsu variable.

const minsu = [ProductDetail && ProductDetail.chart?.nutrientsInfo?.[0].materialsInfo.map(array => array.ingredientsInfo?.[0].chartPercentage)]
console.log(minsu);

// console.log(minsu);
// This is the value of `console.log`.
[Array(3)]
0: (3) ['2', '30', '106']
length: 1
[[Prototype]]: Array(0)

I am now structured like this: 0: (3) [2 30 106].
But I want to delete [], make 2, 30, 106 like this.

How should I write the code?

>Solution :

console.log(minsu[0].join(', '));

Leave a ReplyCancel reply