Calling a function from another object



I have an array in the code of a button (Let’s call it A). But I was to add to that array from another button (Let’s call it B).

However, whenever I refer to the array in button B, I get an error. Is there a way to do this?




If you initialize your array in A like this:

this.array = [1,2,3]

You’ll be able to access it from B like this:

A.array[3] = 4