求大佬解答,下面两种代码的区别

想问问下面liang'duan代码区别在哪里,

        var timer = window.setInterval(function(){

                        heroBullets[heroBullets.length-1].run();
                    },50);
var timer = window.setInterval("heroBullets["+(heroBullets.length-1)+"].run()",50);

本质上没有什么区别,唯一的区别在于,heroBullets是一个闭包变量,而heroBullets.length直接就算出值传入了。
如果heroBullets长度会变化,上面的代码run也会跟着变,下面写死了。