diff options
author | Chris Knight <cknight1234@gmail.com> | 2020-05-26 12:12:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 13:12:07 +0200 |
commit | 9090023c33de7b64ae41425db71c9ab4d5b1237f (patch) | |
tree | 917fa6901391bf4ef12d52d5232b2355bd6ce2b3 /docs/getting_started/first_steps.md | |
parent | 4e92ef7dc9e1d223d9f3099b94579c2b17e4ef9e (diff) |
docs: "Getting started" manual updates (#5835)
Diffstat (limited to 'docs/getting_started/first_steps.md')
-rw-r--r-- | docs/getting_started/first_steps.md | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/getting_started/first_steps.md b/docs/getting_started/first_steps.md index 4b3dd5108..9186af730 100644 --- a/docs/getting_started/first_steps.md +++ b/docs/getting_started/first_steps.md @@ -14,7 +14,7 @@ before attempting to start with Deno. Deno is a runtime for JavaScript/TypeScript which tries to be web compatible and use modern features wherever possible. -Browser compatibility means, a simple `Hello World` program in Deno is the same +Browser compatibility means a simple `Hello World` program in Deno is the same as the one you can run in the browser: ```ts @@ -87,9 +87,9 @@ In this program each command-line argument is assumed to be a filename, the file is opened, and printed to stdout. ```ts -for (let i = 0; i < Deno.args.length; i++) { - let filename = Deno.args[i]; - let file = await Deno.open(filename); +const filenames = Deno.args; +for (const filename of filenames) { + const file = await Deno.open(filename); await Deno.copy(file, Deno.stdout); file.close(); } @@ -112,8 +112,10 @@ This is an example of a simple server which accepts connections on port 8080, and returns to the client anything it sends. ```ts -const listener = Deno.listen({ port: 8080 }); -console.log("listening on 0.0.0.0:8080"); +const hostname = "0.0.0.0"; +const port = 8080; +const listener = Deno.listen({ hostname, port }); +console.log(`Listening on ${hostname}:${port}`); for await (const conn of listener) { Deno.copy(conn, conn); } |