IF Condition evaluation

If that variable is empty, null, or undefined, it will be evaluated as false.

Here are commonly used expressions that evaluate to false:

-> false

-> 0

-> Empty strings ('' and "")

-> NaN

-> undefined

-> null

Here are commonly used expressions that evaluate to true:

-> true

-> Any number other than 0

-> Non-empty strings

-> Non-empty object 

function callMe(param)
{
	if(param)
	{
		console.log('Inside If block');
	}
}

callMe('Manju'); Output: Inside If block

Comments