Academy
ProgrammingJS for BeginnersWhat is a Program?

What is a Program?

The Most Honest Definition

A program is a list of instructions you write for a machine that is:

  • Infinitely fast
  • Infinitely literal
  • Completely without common sense

That last point is the one that matters. A computer will do exactly what you say — not what you meant to say. Every bug you will ever write in your programming life comes from that gap between your intention and your instruction.

JavaScript is the language this lesson is written in. It runs inside every web browser on Earth — on your phone, your laptop, on servers, on smart TVs. You do not need to install anything. You are already running it right now.

Your First Instruction

Press Run below. Watch what happens.

The word console.log() means: "Print this message to the output."

"Hello, World!" is a piece of text. In programming, text wrapped in quotes is called a string — a string of characters.

Change the text inside the quotes to your own name and run it again. That is your first program.

Instructions Run in Order

A program is not just one instruction — it is a sequence. The computer reads from top to bottom, one line at a time, in order.

Try swapping lines 1 and 3. The output changes. Order matters.

This seems obvious now. But when programs grow to thousands of lines and instructions start jumping around and waiting for each other, this single idea — sequence — is what you return to when you are confused.

The Computer Does Not Understand You

Here is a deliberate mistake. Run this:

The computer stops at the error and refuses to go further. It does not guess what you meant. It does not skip the bad line and continue. It halts.

This is not a flaw. This is a feature. A machine that guesses would be far more dangerous than one that complains loudly.

Read the error message carefully — it tells you exactly what went wrong and which line it happened on. Error messages are not failures; they are the computer talking back to you.

Numbers and Text Are Different Things

A computer stores a number and a piece of text very differently. Watch what addition does in each case:

Run it. The results are 30, "1020", and "1020".

Lines starting with // are comments — notes for the human reader. The computer ignores them completely.

The third result surprises almost everyone. When you mix a number and a string using +, JavaScript quietly converts the number into text and joins them. This behaviour has a name: type coercion. It is one of the most famous quirks of JavaScript, and you will meet it again soon.

For now, just notice it. Keep it in the back of your mind.

What You Have Learned

In this first lesson you have seen four foundational ideas:

  1. Instructions — a program is a sequence of commands to a literal machine
  2. Strings — text wrapped in quotes; the computer stores it differently from numbers
  3. Sequence — lines execute top-to-bottom, in order
  4. Errors — the computer stops and tells you exactly where things went wrong

In the next lesson we will learn how to give the computer a memory — how to store a value and use it later. That is where programming starts to feel like thinking.