Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want to get rid of javascript array

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading