0

I have the following problem: I get a set of IDs from a json object:

getIDS which returns:

1299
1399
1499
1599
1699

Then I'd like to add them into an array like this:

[1299, 1399, 1499, 1599, 1699]

I've tried this:

let arr = new Array();
arr.concat(getIDS);

but it outputs it like this in the console:

[1299]
[1399] 
[1499] 
[1599] 
[1699]

What am I doing wrong?

user1177860
  • 509
  • 4
  • 12
  • 24

1 Answers1

0

It seems like your callback is a string. Why not try split. like

getIDS.split(' ');
ChadQi
  • 53
  • 4