Lambda Function If Else Javascript Program