title: Javascript: empty string
body: <p>How to check if a string is empty in Javascript?</p>
  
  <p>I already used this condition <code>if (res32.trim == "")</code> and <code>if (res32 == "")</code> and didn't work.</p>
  
  <p>res32 is a <code>var res32 = str.subtring(111,112)</code> and can have the following values: spaces, 0, 1, 4, 5, 6 and 7.</p>
  
  <pre><code>if (res32 == " ") {
      if (res21 == 000000) {
          document.write("&lt;td bgcolor=#99FF00&gt;&lt;font face=Verdana color=#FFFFFF  size=1&gt;true&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
      }
  } else {
    if (res32 == 0 || res32 ==1 || res32 ==4 || res32 ==5 || res32 ==6 || res32 ==7) {
        if (res21 &gt; 0){
            document.write("&lt;td bgcolor=#99FF00&gt;&lt;font face=Verdana color=#FFFFFF  size=1&gt;true&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;");
        } else {
            document.write("&lt;td bgcolor=#FF0000&gt;&lt;font face=Verdana color=#FFFFFF size=1&gt;false&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;");
        }
    }
  }
  </code></pre>