0

I'm trying to emulate his:

"someArray" => array:3 [▼
    0 => "3"
    1 => "17"
    2 => "21"
  ]

But I'm getting:

  "myArray" => array:1 [▼
    0 => "3,17,21"
  ]

I'm doing:

var optionsChecked = [];
optionsChecked.push($(this).val());
console.log(optionsChecked);

I need to get what I write first

pmiranda
  • 6,162
  • 9
  • 51
  • 114

1 Answers1

0

You can use the spread operator after split()

optionsChecked.push(...$(this).val().split(','));
Maheer Ali
  • 34,163
  • 5
  • 36
  • 62