In JavaScript we have expression and statement. Even though I read the definition about it multiple times, after a while, I still forget which one is which. So, this post is a reminder for everyone like me who confuses these two, so you will never forget it but always keep in mind the difference between expression and statement.
Photo by bruce mars on Unsplash
A JS expression is any valid code that resolves into a value and can be written whenever you would expect a value. Usually expression are written in only one line. For example:
But it’s more complicated than you think . There are different types of expressions:
42
42 + 1
etc.
"Hello World"
"123"
etc.
#difference-between #difference #statement #expression #javascript #programming