Think of it as a language actually, this helped me.
Imagine all of your knowledge has been wiped from your brain.
Now imagine you feel hungry.
You don’t know a word for that feeling, though - yet!
Imagine trying to communicate that hunger with other ppl (who also have no knowledge left in their brains). Take it one step further, imagine everyone trying to communicate hunger in their own way…
That could be confusing.
JS let’s you define variables, which is basically the same thing as agreeing upon words to use. But in scope of the code itself. There are naming conventions but every programmer can call variables like whatever floats to mind or seems useful - so every program is like a whole new world of “blank minds” who agreed upon their own words to use for things that are the same for many programs if you look closely enough.
Just like the feeling of hunger that has different names in different languages, the meaning however is very alike. You will see the syntax might be different in many other programming languages similar to JS, but the “feelings” and “things” are very similar between them, too.
For programming, things that you will commonly see are:
- variables (think of letters here)
- functions (think of words with a meaning)
- arrays (think of a collection of things like variables, functions, arrays, etc.)
- objects (think of a definition of a real life object like: color, size, weight, etc. that’s what goes into the object code)
- conditional statements (what to do if A or B or nothing at all happens, think of a guide for a task like making coffee)
… just to name a few, there’s much more for you to discover.
Once it “clicks” you will see many parallels to how things in the real world actually work.