Skip to content
Advertisement

How to update a single array using multiple instances of a class

How can I make two instances of a class, update the same array from that class? Like here, I want r1 and r2 to update same pendingOrders, so that finally the array is [‘yo’, ‘lo’]. That is not happening, the r1 and r2 are making different arrays.

JavaScript

Advertisement

Answer

Add the static keyword to the pendingOrders in Robot.
Check this guide for more info

Advertisement