An expression in Javascript (and pretty much all languages, with variation) at the most basic level is just "anything that takes on a value".
So the number 42 or the string "Hello world" or 7 + 3 because they all "take on" a value (42, Hello world, and 10).
As you can tell from this definition, almost everything is an expression. The only other "type" of thing are statements, which there's a more limited number of (depending on language). Things like if / else in Javascript or for because these things don't take on values (you couldn't write something like let variable = if (true) { ... }).
An expression in Javascript (and pretty much all languages, with variation) at the most basic level is just "anything that takes on a value".
So the number
42or the string"Hello world"or7 + 3because they all "take on" a value (42, Hello world, and 10).As you can tell from this definition, almost everything is an expression. The only other "type" of thing are statements, which there's a more limited number of (depending on language). Things like
if / elsein Javascript orforbecause these things don't take on values (you couldn't write something likelet variable = if (true) { ... }).In Kotlin you can ...