is it bad for the function to return values of different type
<p>I  wonder if its considered a  bad prcatice to  return values of different type for the function. Consider the code:</p>

<pre><code>function getInterval() {
 var interval = getIntervalValueFromLocalStorage();
 if (interval &lt; 0) {
  return false;
 }
 return interval;
}
</code></pre>

<p>So whenever I  need the  interval  that function  returns I  can write</p>

<pre><code>var interval = getInterval();
if (interval) {
 //do some staff
}
</code></pre>

<p>In this case:</p>

<pre><code>function getInterval() {
    return  getIntervalFromLocalStorage();
}
</code></pre>

<p>I  will have to  check if the interval is less than 0 and it doesn't seem  very  neat</p>