Jump to content

Why use return statement


arun
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...