I have an array of months like this:
var months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
What i am trying to do is make the name of the month a variable and set an object to it like so:
for(i=0;i<11;i++){
months[i] = $(".bitem:eq("+i+")");
}
But that just replaces months[i] (if i=0 for example it would replace "jan" with the object). What i want to do is use the string that months[i] is equal to for the variable name. I tried using .toString() like this:
for(i=0;i<11;i++){
months[i].toString() = $(".bitem:eq("+i+")");
}
but I get the error:
Error: ReferenceError: invalid assignment left-hand side
.bitemelements to corresponding months?var jan = ...dynamically?months[i] = $(".bitem:eq("+i+")").text();