Problems with js arrays

defines an array days,. When I changed the value of this.day1 in the array, the value of days did not change. Is there any way to make elements in days an array address reference? Hopefully, when day1 changes, so does the value of days [0].

clipboard.png

clipboard.png

clipboard.png


this.day1 = [];day1days[0]day1

clipboard.png

Jun.11,2021

change this.day1 = [] to this.day1.length = 0

this.day1 = [] changes the reference of day1, this.day1.length = 0 is emptying the array


if you initialize this.days1 into an array first. Then assign a value to days. This is a quote. If you don't achieve your goal, your this.day1 should be a simple type at the beginning of the assignment.

Menu