Expression Vs Statement in JavaScript
When learning javascript these two terms come quite often. So it's better to learn about these terms to become a pro-javascript developer. So let's get started.
Expressions: In JavaScript expression, any piece of code returns a value or becomes a value.
For example 100 + 50; // Here, these two numbers get evaluated and return us a value so it's an expression.
“JavaScript” + “ is fun”; //Here also when these two strings are evaluated they return a value so it’s also an expression.
Statements:- Statements are those lines that control the execution of a program. Statements include loops, switch statements, control statements. Basically, statements are those lines of code that don’t produce a value instead they control how a program should execute.