이 방법이 가능하지는 모르겠지만 문자열과 같은 이름을 가진 개체를 선택하여 사용하는 방법이 있습니다 각각의 루프에서?문자열과 같은 이름의 개체를 선택하는 방법이 있습니까
var test = "myobj";
var myobj = {"1" : "2", "2" : "3"};
function testing(test){
// If i do a console.log on the variale "test":
console.log(test); // will show the string: "myobj"
typeof(test); // is string
// somehow select the object with the name myobj, and maybe iterate through it?
jQuery.each(myobj, function(key, val){
alert(val); // right now this will alert the actual letters: m y o b j
});
}
'window [myobj]'를 사용하면 어떻게됩니까? –
창 [ "myobj"]을 사용하여 작동했습니다.이 질문에 대답 해 주시고 이유를 설명해 주시겠습니까? 타이 ..이 크로스 브라우저 야? – user2065483
Sebastian의 설명을 보면이 대답이 명확하면 답변을 승인 할 수 있습니다 –