Skip to content

Commit 678ada7

Browse files
committed
updated lots of copy in the first JS tutorial
1 parent dad2c8e commit 678ada7

2 files changed

Lines changed: 40 additions & 47 deletions

File tree

js/lesson1/tutorial.md

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,35 @@ JavaScript is a programming language that runs in all modern web
1111
browsers. It is used to change what is displayed on a web page in
1212
response to user activity.
1313

14-
This tutorial will give you your first introduction to JavaScript. It
15-
barely scratches the surface of all the things that you can do - this
14+
This tutorial is intended to give you a very brief introduction to JavaScript. It
15+
barely scratches the surface of all the things that you can do with it - this
1616
one is intended to be just enough for you to understand our next
1717
tutorials that do more interesting things.
1818

19-
Some words in programming have special meanings. We're going to take
20-
some time during this tutorial to explain what some of the most
21-
commonly used words mean. Words which mean a specific thing will be
22-
marked in **bold**. Try to remember them, because it's important for
23-
you to understand what other programmers mean when they use these
24-
words, and what the documentation means when you read it. You can
25-
always look back at this tutorial later to remind yourself.
19+
Most words in programming have special meanings. We're going to take
20+
some time during this tutorial to explain what some of the commonly used words mean. Words which mean a specific thing will be marked in **bold**. Try to remember them, as it's important for you to understand what other programmers mean when they use them, and what the documentation means when you read it. You can always look back at this tutorial later to remind yourself.
2621

2722
## Getting started
2823

2924
Download the files required to begin working through the tutorial from [here](https://gist.github.com/despo/0b674ec9d5ae9cb09704/download).
3025

31-
We recommend that you use chrome for this tutorial, as the
26+
We recommend that you use Chrome for this tutorial, as the
3227
instructions are written to match it closely, but you should be able
3328
to do all the same things in any web browser.
3429

3530
We've given you two files. One is `script.js`, which you should open
3631
in your text editor. This is where you're going to write your
3732
code. The other is `index.html`, which you should open in your web
38-
browser. This is a very short file that just tells your browser to run
33+
browser. This is a very small file that tells your browser to run
3934
the code in `script.js`.
4035

4136
For this tutorial, you will also need to open the console. In
4237
Google Chrome, use `Ctrl + Shift + J` on Windows/Linux
43-
or `Alt + Cmd + I` on Mac. The console should look something like this:
38+
or `Alt + Cmd + I` on Mac. You can also right click with your mouse and press "Inspect". The console should look something like this:
4439

45-
<img src="assets/images/console.png" alt="console example">
40+
<img src="assets/images/console.png" alt="google chrome console example">
4641

47-
The console can appear in several different places. Below is the example of two of them: "docked to bottom", and "docked to right". You can change the location of the console by clicking on the three vertical dots located next to the cross (clicking on the cross will close the console). Their locations are indicated on the picture below.
42+
The console can appear in several different places. Below is the example of two of them, the first "docked to bottom", and the second "docked to right". You can change the location of the console by clicking on the three vertical dots located next to the cross (clicking on the cross will close the console). Their locations are indicated on the picture below.
4843

4944
<img src="assets/images/console-locations.png" alt="console locations">
5045

@@ -82,7 +77,7 @@ Let's move on to writing code in a file. Type the same `console.log`
8277
line into your `script.js` file. Save and reload the page in your browser so that it
8378
can read the change you made.
8479

85-
This time, you should just see the line that says `Hello!` in the browser console, and not
80+
This time, you should only see the line that says `Hello!` in the browser console, and not
8681
the lines that said `console.log('Hello!');` or `undefined` with
8782
arrows next to them. That's because you didn't type the JavaScript
8883
into the console this time.
@@ -113,17 +108,21 @@ expression. As you've just seen, the value of `1` is just `1`, and the
113108
value of two numbers with a `+` sign between them is those two numbers
114109
added together.
115110

116-
We want to do things with words as well as numbers. A value containing
117-
letters is a **string**, and you write it in quotes. Try typing
118-
`'Hello'` on the console. Like before, you'll see it repeated back to
119-
you.
111+
112+
> Now that you've learnt how to some simple maths, why not try out some more in your console?
113+
114+
115+
But, on websites we don't just see numbers so we want to do things with words too. A value containing letters is a **string**, and you write it in quotes. Try typing
116+
`'Hello'` on the console. Like before, you'll see it repeated back to you.
120117

121118
Try `'Hello' + 'there'`. You should see it combine the two strings
122119
into one. The value of two strings with a `+` sign between them is
123-
those two strings concatenated. You'll also see that it's missing a
120+
those two strings **concatenated**. You'll also see that it's missing a
124121
space - can you fix that?
125122

126-
Try typing `Hello` without any quotes around it. See how you just get
123+
> Now that you've learnt how to concatenate 2 strings, trying practising a few more so you become more comfortable with it?
124+
125+
Try typing `Hello` without any quotes around it. See how you get
127126
an error about `Hello` not being defined? Words that are not wrapped
128127
in quotes are not strings. There's a couple of things that they could
129128
be, which we'll discuss later, but the important thing to remember for
@@ -147,13 +146,11 @@ Try typing this on the console:
147146
var a = 17;
148147
```
149148

150-
You'll see that it returns the value as `undefined`. undefined just
149+
You'll see that it returns the value as `undefined`, undefined
151150
means that the thing you typed doesn't really have a value. However,
152151
this did something else: it created a **variable** named `a`.
153152

154-
Now try typing `a` on the console. You should see that you get back
155-
17. Variables are a way of giving names to **values** so that you can
156-
use them later.
153+
Now try typing `a` on the console. You should see that you get back 17. Variables are a way of giving names to **values** so that you can use them later.
157154

158155
Try typing these:
159156

@@ -175,7 +172,7 @@ You can also change the value of a variable. That's why it's a
175172
b = 2;
176173
```
177174

178-
Notice that you don't have `var` this time. If you just have a
175+
Notice that you don't have `var` this time. If you have a
179176
variable name, an equals sign, and an expression, then this is a
180177
**variable assignment**, which changes the value of a variable that
181178
you defined earlier.
@@ -245,15 +242,15 @@ again.
245242

246243
Let's move some of this into `script.js`. We wrote the function
247244
definition all on one line because that's all the space you have in
248-
the console, but the normal way to write one is like this:
245+
the console, but the typical way to write a function is like this:
249246

250247
```js
251248
function sayHello() {
252249
console.log('Hello!');
253250
}
254251
```
255252

256-
Put that into `script.js` and reload the page. Now just try calling
253+
Put that into `script.js` and reload the page. Now try calling
257254
the `sayHello` function on the console, without doing anything else.
258255
You should see that it still works, using the definition that you put
259256
into `script.js`.
@@ -270,7 +267,7 @@ function conversation() {
270267

271268
Try calling the `conversation()` function on the console. See how it
272269
did all three things in order? Functions are lists of things to
273-
do. When you call the function, it does all the things in its
270+
do. When you call the function, it will do all the things in its
274271
definition.
275272

276273
Let's get a few words for these things before we move on:
@@ -306,10 +303,9 @@ function sayHello(person) {
306303

307304
Now try calling it using `sayHello('Archibald')`.
308305

309-
That probably isn't your name. Try calling the function again using
310-
your own name.
306+
> Try calling the function again using your own name?
311307
312-
What you've done here is to add a **parameter** to the function. When
308+
What you've done here is added a **parameter** to the function. When
313309
you call the function, you put a string between the parentheses. In
314310
the definition, you put the word `person` between the
315311
parentheses. While the function runs, `person` is defined to be a new
@@ -340,7 +336,7 @@ far, this one has a value.
340336
`return` is another **keyword**: it means "return the value of this
341337
expression from this function". The value of a **function call** is
342338
the value that was given to `return`. If the function got to the end
343-
without ever seeing `return` then the value of the call will just be
339+
without ever seeing `return` then the value of the call will be
344340
`undefined`.
345341

346342
Now change your `sayHello` function to use this new `greeting`
@@ -349,9 +345,8 @@ function, instead of having the message in it. Check that
349345

350346
## Multiple function parameters
351347

352-
Functions can have as many parameters as you want. You separate them
353-
with commas. Try changing the first line of the definition of
354-
`conversation` to be:
348+
Functions can have as many parameters as you want, you separate them
349+
with commas. Change the first line of your `conversation` function to be:
355350

356351
```js
357352
function conversation(person, topic) {
@@ -366,7 +361,7 @@ Similarly, you call the function like this:
366361
conversation('Archibald', 'owls');
367362
```
368363
369-
Try it out for yourself.
364+
> Try it out for yourself.
370365
371366
### What you've learned so far
372367
@@ -396,18 +391,17 @@ console.log(
396391
);
397392
```
398393
399-
Use spaces and newlines to make your program easy to read. When you're
400-
just starting out, it won't be immediately clear to you what makes
401-
things easier to read, so just try to follow the patterns that we use
402-
in the tutorials. As you read and write more programs this will start
394+
Use spaces and newlines to make your code easier to read. When you're
395+
starting out, it won't be immediately clear to you what makes
396+
things easier to read, so try to follow the patterns that we use
397+
in the tutorials. As you write more code this will start
403398
to make sense to you.
404399
405400
### Semicolons
406401
407402
Semicolons are needed after any statement that does not end in a
408403
`}`. While it is sometimes possible to leave out semicolons and have
409-
the program still work, this is likely to break in surprising ways, so
410-
you should try to put them in the right places.
404+
the program still work, we suggest doing this when learning to make it more readable.
411405
412406
One important exception to these rules is the `return` statement. You
413407
may not add a newline immediately after the word `return`, because if
@@ -437,8 +431,7 @@ We apologise for this quirk of the language.
437431

438432
## Objects
439433

440-
Another type of **value** is an **object**. A way to create an object
441-
is like this:
434+
Another type of **value** in JavaScript is an **object**. An object looks like this:
442435

443436
```js
444437
var person = {
@@ -515,7 +508,7 @@ return to them in a later tutorial.
515508

516509
## Summary
517510

518-
You now know what all of these words mean:
511+
You should now be familiar with these words and what they mean:
519512

520513
* strings
521514
* expressions

stylesheets/github.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body {
22
font-family: Helvetica, arial, sans-serif;
3-
font-size: 14px;
3+
font-size: 16px;
44
line-height: 1.6;
55
padding-top: 10px;
66
padding-bottom: 10px;

0 commit comments

Comments
 (0)