``` ```
```

TM352 · JavaScript · September 2026

Revisiting JavaScript

I've studied JavaScript before, but starting TM352 has given me an opportunity to go back over the fundamentals. This time I've been taking things more slowly, experimenting with the examples and making sure I understand the concepts rather than simply getting the code to work.

Going back to the basics

JavaScript isn't new to me. I've encountered it during previous study and programming projects, but I don't think I fully understood some of the fundamentals the first time around.

One thing I've found useful this time is deliberately slowing down. Instead of rushing through simple examples because they look familiar, I'm trying to understand what each part of the code is actually doing.

The first exercise involved creating a JavaScript file and running it using Node.js.

console.log("Hello!");

I could then run the file from the terminal:

node hello.js

Which produces:

Hello!

It's about as simple as a program can get, but revisiting these basics has been useful because it gives me a chance to think about what is happening rather than just recognising the syntax.

JavaScript and Node.js

One of the things I reviewed was the difference between JavaScript and the environment in which it is being executed.

JavaScript can run in a web browser, where it can interact with HTML and the contents of a web page. It can also be executed outside the browser using a runtime such as Node.js.

In these early exercises, I was using Node.js to run JavaScript from the terminal. This gives me a simple environment in which to experiment with the language before applying it to web pages.

Understanding console.log()

One of the simplest JavaScript commands is console.log().

It can be used to output information while a program is running, which makes it particularly useful when learning and debugging.

Looking at the expression more closely also helps explain some JavaScript terminology. console is an object and log is a method that we are calling.

This is a small example, but understanding the difference between objects and methods will become much more important as the programs become more complicated.

Variables

I then reviewed variables using the let keyword. Variables can have their values changed during the execution of a program.

let a;
```

let b = 4;

a = 3;

console.log(a);
console.log(b);

a = a + b;

console.log(a);
```

The output is:

3
```

4
7
```

There are several small ideas here that are worth understanding. The first line creates a without assigning it a value. The second creates b and gives it the value 4.

The statement a = 3 then assigns a value to a. Later, a = a + b takes the current values of a and b, adds them together and assigns the result back to a.

So the value of a changes from 3 to 7.

Constants

I also reviewed the difference between variables and constants. Constants are declared using const.

const A = 3;
```

const B = 4;

const C = A + B;

console.log(A);
console.log(B);
console.log(C);
```

This produces:

3
```

4
7
```

A constant has to be given a value when it is declared, and that binding cannot later be reassigned.

The important distinction is therefore that let is used when a value needs to be reassigned, while const is used when it should not be reassigned.

Experimenting with the examples

One of the things I've been doing differently this time is changing the examples myself rather than simply following them.

For example, I experimented with some values representing years:

const A = 3;
```

const B = 4;

const C = A + B;

let year = 2024;

let currentYear = 2027;

const YEAR = 2024;

const CURRENT_YEAR = 2026;

console.log(A);
console.log(B);
console.log(C);

console.log(year);
console.log(currentYear);

console.log(YEAR);
console.log(CURRENT_YEAR);
```

This is a very small experiment, but it illustrates something important about how I learn programming. When I change the examples and deliberately test things, the concepts tend to stick much better.

Understanding rather than remembering

One of the main things I'm taking away from this review is that recognising a piece of code isn't necessarily the same as understanding it.

I've seen JavaScript before and have been able to write working programs, but slowing down and looking at the fundamentals again has helped fill in some of the gaps in my understanding.

For me, the useful part of this review isn't memorising that let creates a variable or that const creates a constant. It's understanding why I would choose one rather than the other and what happens when the program runs.

What I'm taking away from this

I'm still early in TM352, but I'm enjoying approaching familiar material at a slower pace. Hopefully this will give me a stronger foundation as the module moves from basic JavaScript towards more complex web applications.

← Back to Learning & Development
```