what is statement and expression in javascript ?

Expression and Statement are very important component in javascript language.
Expression : Expression always create  value and can be set wherever a value is expected like function arguments or value assigning  in a variable.


Statement : In javascript statement perform action. Loop and if statement are example  of statement. Javascript wherever expect statement you can put expression but you can not put statement  where expression expect .

This is statement


This is expression(function as expression)

function(){return true;}

So you can put expression in where statement is require

if(function(){return true;}){}

But you can not put statement in where expression is require


In next article i will describe why this two things are very important.

Leave a Reply

Your email address will not be published. Required fields are marked *