I know that my question might be questioned before by others.
I am referring to this question on stackoverflow. Dogbert already give the answered correctly. here Dogbert answered:
var myObj = {
1: [1, 2, 3],
2: [4, 5, 6]
};
var array = $.map(myObj, function(value, index) {
return [value];
});
console.log(array);
output:
[[1, 2, 3], [4, 5, 6]]
I add 1 line code after output console.log
which to pass the data to text field
$('#assign').val(array);
I got the value array
in my text field like this:
1,2,3,4,5,6
Is there any way to reformat the data on text field become like this:
[[1,2,3],[4,5,6]]
or
[{1,2,3},{4,5,6}]
Really hope from anyone help! thanks