You have probably built a Lego model or a shelf from IKEA. And you used a manual for that, that contained multiple steps. It is important to follow the order of the manual, otherwise your Lego model will not look like it should or your shelf is not stable.
An IKEA manual for the shelf Billy
A lego manual (BrickFanatics, 07.03.2022)
But what do Lego or IKEA have to do with programming?
More than you might think.
When programming, it is your job to write a manual for the computer to solve a task. Every instruction in the manual is a statement in your code. When you are finished writing this manual, your computer can execute it.
Your job is to figure out which statements in which order are solving the task.
That might sound complicated in the beginning, but for now, we just assume that one line of code is one statement in JavaScript and our program is executed from the top to the bottom of the file and every statement ends by writing a semicolon at the end of the line: ;
.
Code is executed from top to bottom, from line 1 to line 5 in this example