for example i have a function like below
var testName= "";
testName= $('.test').map(function() {
// get text
return $(this).text()
// get result as array
}).get();
var testResult= {
name:testName,
};
console.log(testResult);
The result i can see from my code is
Which is not something i wanted.
I want to split those data and assign them one by one
"testResult": [
{
"name": "test1"
},
{
"name": "Thug life"
}
]
I tired to use for loop to handle those data but it doesn't help
for(var i; i < testName.length; i++){
var testName= testName + [{
name:testName[i],
}];
}
