-1

I want to get an array from strings

const id = 1,8,10
output = ['1','8','10']

Any idea how to do it?

1 Answers1

1

If the numbers are separated by , u can split the string like this:

const id = '1,8,10'
const output = id.split(',')

console.log(output)
>>> ["1", "8", "10"]
marcos
  • 4,473
  • 1
  • 10
  • 24