It is the language understood by all modern web browsers.
Source code is the code you write in a text editor and save in a file.
In the case of the browser, there are many, many APIs available to you to do all sorts of complicated things.
You will need to use an API to do anything at all that the user of your program can see.
The internal parts of the language are "just" what it uses to actually do it's calculations.
The alternative approach, which is the one usually taken by introductory programming tutorials is to mix the two together, in a way that builds experience of both solving programs and making interfaces.
There's nothing at all wrong with that approach. I just want to explore the possibility of teaching only the language.
Although the other approach works, I think it might leave something lacking that you might be able to get at by separating it out.
What is the beginning, then?
The beginning is to set up a workspace and get comfortable with a workflow.
We are really spoiled with options when it comes to doing this now, but it's worth taking the time to get it set up to start with, because the tools are really great.
Then you should start.
All this means is that we can use this API to print things to the console.
What is the console?
First program is
Now find the output. Once you've found the output, change it in your source code to "hello world!" and watch as it gets updated.
The basic nature of computer programs is to manipulate representations of information to produce an output.
let a = 4; console.log(a);
You can store numbers and add them together
let a = 3 let b = 4 let c = a + b console.log(c)
let a = 3 let b = 4 let c = a + b console.log(a + b)
When we say "let a = 3" we are doing two things at once - both "declaring" and "initialising" the variable.
These can be separated. So, instead, you could do
let a let b let c a = 3 b = 4 c = a + b
So far we have seen: * the 'let' keyword for declaring a variable you are going to use * variable names themselves - these can contain letters and numbers (and other symbols?) but must start with a letter and usually start with a lower-case letter. * "numbers" - like 3 and 4 in the example above. These are called "number literals" because they are "literally" what they say they are. * two "operators" + and = * the use of "console.log" to print things out
You can probably do 3 + 4 in your head pretty quickly, but you can change the numbers 'a' and 'b' in the example above to anything at all.
NB: this is important/relevant because what we're really trying to do is gain super-powers, right? By learning this thing, we want to be able to do new things.
Now you can add together any numbers you want.
What is an integer?
- generating times tables - adding all the numbers in a sequence