arun Posted May 20, 2017 Share Posted May 20, 2017 Hi friends, please explain me the code below. why we use return here? fire: function() { if (this.nextShotAt > this.time.now) { return; } if (this.bulletPool.countDead() === 0) { return; } Link to comment Share on other sites More sharing options...
scheffgames Posted May 20, 2017 Share Posted May 20, 2017 I don't want to be mean but have you considered picking up a Javascript book to teach you the basics? You'll be stranded forever on forums asking (extremely) basic questions and struggling to understand code. To answer to your question however, "return" it's a Javascript keyword that stops executing the current function (and returns a value or nothing) and returns control to the calling function. Link to comment Share on other sites More sharing options...
Recommended Posts