I have the following objects:
var Something= {
"None" : 0,
"2D" : 1,
"3D" : 2,
"4D" : 3,
"5D" : 4,
"6D" : 5,
"7D" : 6
};
function SomethingElse(obj) {
this.2D = 0;
this.3D = 0;
this.4D = 0;
this.5D = 0;
this.6D = 0;
this.7D = 0;
for (var prop in obj) {
this[prop] = obj[prop];
}
}
I have an integer from which I want to get the propertyName of Something
(for example, if I pass in 2 I should get back the string "3D". How do I do that?
Eventually I want to use that to set the value of SomethingElse[propertyName] = 0;