Home > Blockchain >  How can i get data from array of object like serial number in reactjs
How can i get data from array of object like serial number in reactjs

Time:01-17

How can i get data from array of object like serial number in reactjs

const number = [1, 2, 3] i want to get get data like this number = 1,2,3.

CodePudding user response:

You can use the map method to iterate over the array of numbers and extract the values you want to use.

const numbers = [1, 2, 3];
const serialNumbers = numbers.map(number => number).join(",");
console.log(serialNumbers); 

CodePudding user response:

The join method unites the array with the parameter that you pass to it, in this case none

number.join('')
  • Related