Answer the question
In order to leave comments, you need to log in
Why doesn't it find the map in the array?
There is a code:
function ss() {
var data = [{
"24KALT": {
"md5": "f6efd002536cc08a8fe09d3756e1d625",
"storageType": 0,
"url": "",
"version": 2
},
"24K": {
"md5": "a913b583f0c5b7a2966c62d6e315b3e6",
"storageType": 0,
"url": "",
"version": 2
}
}];
var val = data.shift();
var kk = document.getElementById('search').value;
alert(val.kk.version);
}
Answer the question
In order to leave comments, you need to log in
alert(val[kk].version);
If val.kk.version, then the reference will be to the field with the name "kk", and not to the field whose name is in the kk variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question