mardi 31 août 2021

What is the use of return inside an if else block that isn't inside a function body? [closed]

I came across a code in which return is used inside an if-else block. But the if-else block is not inside a function body; and it doesn't throw any error. So what is the use of using return inside if-else that is not inside a function body? (Specifically for Node.js)

if(true) {
  return 'foo';
}

Here is the demo. Thanks in advance!!!

Aucun commentaire:

Enregistrer un commentaire