Statements & Expression Flashcards

1
Q

What is an expression ?

A

Expression is a piece a code that produces value.

Example 1 :- if (23 > 10) {
  const str = '23 is bigger than 10';
  console.log(str);
}
Example 2 = ’23 is bigger than 10;

Anything we get as an output is also called as an expression
Example = 2+ 2 = 4 ( this is an example of an expression

Here in the above example 2 - string itself is an expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Statement ?

A

Any thing which ends with a Semicolon ; is statement.

Example = ’23 is bigger than 10;

Here in the above example - string itself is an expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly