Like the title
For example, what I want to achieve is that I pass an array through the tp framework and I want to turn it into an array object
var data = [];
var countObj ={};
var tagNumObj ={};
for (var i = 0; i < 7; i ) {
1 2 3 4 5 6 7 |
|
}
console.log(data);
This is how it is displayed
var count = ;
var tagName = "";
countObj = {'count':count};
tagNumObj = {'tagName':tagName};
data[i] = countObj;
data[i] = tagNumObj;
If the above is written like this
for (var i = 0; i < 7; i ) {
1 2 3 4 5 6 7 |
|
}
This is how it is displayed
var count = 8;
var tagName = "Hello";
countObj = {'count':count};
tagNumObj = {'tagName' :tagName};
data[i] = countObj;
data[i] = tagNumObj;
It means that i is not obtained, but how to get this i? Please answer. Or is there any other way to convert an ordinary array into a js array object? That’s fine. I’d like to ask sincerely
高洛峰2017-06-05 11:12:33
If it is template assignment, use PHP to loop directly
1 2 |
|
If it is an interface to obtain the value, use json directly