I pass a string through "objName".
I want this to to be stored in the line: facebookData.objName
For example:
if I invoke the function like, fetchData(0, response, "friendsCount") , the object should be like: facebookData.friendsCount = dLen;
Note: facebookData is a global object.
function fetchData(dLen, response, objName){
if(response.paging){
if(!response.paging.next){
facebookData.objName = dLen; //Problem is here
return dLen;
}
else{
-------------------
fetchData(dLen, response, objName);
}
}
使用括号:
facebookData[objName] = dLen;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.