Performance: Running your first Deno program
This affects the initial load and startup time of your Deno program, impacting how quickly the program begins execution.
console.log("Hello from Deno!");import { serve } from "https://deno.land/std@0.177.0/http/server.ts"; console.log("Hello from Deno!"); serve(() => new Response("Hello World"));
| Pattern | Dependency Fetching | Compilation Time | Startup Delay | Verdict |
|---|---|---|---|---|
| Simple script with no imports | None | Minimal | Instant | [OK] Good |
| Script with remote imports | Network fetch required | Higher due to dependencies | 100-300ms delay | [X] Bad |
deno run followed by the file name to execute scripts.deno run filename.ts or deno run filename.js. Other options are for Node.js or incorrect commands.console.log().print() or echo() are not valid in JavaScript or Deno. console.print() is not a function.console.log('Welcome to Deno!');console.log() function prints the string inside the parentheses to the console.console.log('Hello Deno!')deno run hello.ts, you get an error. What is the most likely cause?greet.ts that prints a greeting. Which command will correctly run the program if your terminal is in the same folder as the file?./greet.ts explicitly points to the current directory.deno rungreet.ts is invalid because there's no space after run. deno run ../greet.ts points to the parent directory, which is wrong here. deno start greet.ts is invalid.Pass the test and this pattern moves unknown