Calling a function from another object


#1

Hello!

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?

Thanks.


#2

Hi!

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