Is there a known problem with array of objects ? when assigning a value e.g. to a[0].name, the element a[1].name gets also the same value

35 views Asked by At

I'm assigning a value to an array element, e.g. array1[0].name, then array1[1].name, array1[2].name,... gets also the value assigned only to array1[0].name.

The following code, is very symplified:

the following object is passed over to this function as an argument, and has the structure:

var reccurenceObject = {
   howOften:,
}

the code:

for (var j = 0; j < cycle; j++) {                     
      eventsArray[j].howOften = reccurenceObject[j].howOften; 
}

Any idea why elements with different index are getting the values also ?

Thank you for any Helo.

Dani

0

There are 0 answers