I have a simple javascript object with several unknown properties containing a value. The problem is that i don\'t really know the name of the field since it is variable. Ho
You can do somethine like this:
for (var member in a) {
alert('Name: ' + member);
alert('Value: ' + a[member]);
}
for more info about reflection in JS see here:
http://lpetr.org/blog/archives/reflection-in-javascript
You could access the properties by name:
for (var key in a) {
var value = a[key];
}
Demo.