Can we write IF statement without else in javascript
<p>I wrote some code to create an simple todo app in angular js. I have the following function code to remove the tasks from the list.</p>

<p><strong>Javascript code</strong></p>

<pre><code>$scope.deleteTask =  function(){
    $scope.tasks.splice(this.$index, 1);
    if($scope.tasks.length &lt; 1){
        $scope.noTask = true;
    }     
};
</code></pre>

<p><strong>HTML code</strong></p>

<pre><code>    &lt;li ng-repeat="task in tasks track by $index"&gt;{{task}}  &lt;button ng- click="deleteTask()"&gt;x&lt;/button&gt;&lt;/li&gt; &lt;/li&gt;
    &lt;p ng-show="noTask"&gt;No Tasks Available &lt;/p&gt;
</code></pre>

<p>I wanted to show a message when there are no tasks in the list. i have achieved this using "if" statement. but i don't need an else here. i am not sure whether its the right way. what will be the proper way to achieve this </p>