1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00
denoland-deno/docs/examples/testing_if_main.md

11 lines
215 B
Markdown
Raw Normal View History

2020-05-06 18:21:13 -04:00
## Testing if current file is the main program
To test if the current script has been executed as the main input to the program
check `import.meta.main`.
```ts
if (import.meta.main) {
console.log("main");
}
```