r/learnjavascript • u/WolfComprehensive644 • Feb 08 '26
What “semantic” actually means in programming?
The word “semantic” gets used a lot in programming: semantic HTML, semantic versioning, semantic meaning of code.
But most of the time it’s treated as something abstract or academic.
In practice, “semantic” just means this: the meaning of something is conveyed by what it represents, not by how it is implemented or rendered.
Example in JavaScript:
const isReady = true;
vs
const flag = true;
Both do the same thing. Only one communicates intent.
The semantics don’t change execution. They change understanding.
Once you start looking at code this way, a lot of “best practices” suddenly make sense.
View all comments
Show parent comment
1
u/azhder Feb 10 '26 edited Feb 10 '26
How about when you define things, you don't use "about" and use "is"? See how that works out for you.
You start with the very thing it is, not about or means or whatever (means would be OK if you are defining an action), then you put a (metaphorical) comma and after it explain the specifics of that particular version of what you defined before the comma.
Syntax is the form and relations between the forms of the symbols, like words and sentences, but can be any kind of symbol.
Semantics is the idea, the meaning behind the syntax, what it represents, not how it is presented.
Funny observation, there is no “on top” here as you see, but “behind”.