I am getting a group of array from database in this format [52,16,135],[54,16,140],[22,16,140] and I need to push all elements of of it into new array separately but looks like my code adding them as an array to the code
but what I need is
[
"True",
"52",
"16",
"135",
"54",
"16",
"140",
"22",
"16",
"140",
"Other Value"
]
var str = '[52,16,135],[54,16,140],[22,16,140]';
var arr =[];
arr.push('True');
arr.push(str.replace(/\[/g, "").replace(/\]/g, "").split(','));
arr.push('Other Value');
console.log(arr);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
var str = '[52,16,135],[54,16,140],[22,16,140]';
var arr =[];
arr.push('True');
arr.push(str.replace(/\[/g, "").replace(/\]/g, "").split(','));
arr.push('Other Value');
