Skip to content

Instantly share code, notes, and snippets.

@mmoehrlein
Created November 24, 2021 14:20
Show Gist options
  • Select an option

  • Save mmoehrlein/b9104e25d535cd809cf54f9ddbd156fc to your computer and use it in GitHub Desktop.

Select an option

Save mmoehrlein/b9104e25d535cd809cf54f9ddbd156fc to your computer and use it in GitHub Desktop.
js if statement to check if file is run directly or required by something else
// if executed directly, start the main function
if (require.main === module) {
main();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment