I'm trying to initialise some data values dynamically inside a javascript object, but when I create a concatenated string to pass along, the actual key stored is the variable name, instead of the value inside it.
Example:
projects.init = function(){
for (var i = this.numBoxes - 1; i >= 0; i--){
var toInject = "item"+i;
this.datas[i] = {toInject:"testdata"};
};
}
Then after calling init, the values inside projects.datas look like.. toInject "testdata", instead of being "item1"..."item2".... what am I doing wrong..?