i have an array like this coming back response from the server:
[
\"111\",
\"1010\",
\"111\",
\"1010\",
\"1010\"
]
i want t
You can use map() to create a new array with the results of calling a provided function on every element in the calling array
var arr = [
"111",
"1010",
"111",
"1010",
"1010"
]
var res = arr.map(i => ({'branch': i}));
console.log(res);
You could map a short hand property.
var array = ["111", "1010", "111", "1010", "1010"],
result = array.map(branch => ({ branch }));
console.log(result);