Buttons Created using a loop with a common function not working as expected

I Have Multiple buttons created using for loop with a method. The method will log the clicked button on the console, but when the buttons are the clicked, the method of the last created button in the loop only works. Please help me with the issue.

Here’s the Babylon PG that illustrates the issue, Open console to check the method call.


Really simple tweak I made, changed “var” to “let”, I learned this lesson the hard way myself :sweat_smile:


Oh wow that works for me…Looks like this is actually a javascript issue by itself…Thanks for helping me on this.

1 Like