title: Check if a string in an array has white space character in javascript/jquery
body: <p>I am trying to type a text in a conteneditable div and when I loop through them the for loop as an array and check if there are any white space characters (i.e <code>abc  de</code> i.e space between the two words it does not recognize them as empty string ). Please see below code.</p>
  
  <p><strong>Script:</strong></p>
  
  <pre><code>function htmltoBBcode() {
      $("#hidden").html($('#textEditor').html());
      $("#hidden").html($('#textEditor').html()); 
      var arr=$("#hidden").text();
      for(var i=0;i&lt;arr.length;i++)
      {
          if(arr[i]=='')
          {
               console.log("i is true"+arr[i]);
          }
          else{
              console.log("i is false"+arr[i]);
          }
      } 
  }
  </code></pre>
  
  <p>In the above code, I am taking the text from the contenteditable div and looping through them, if the <code>arr[i]==''</code> it should <code>return true</code> in the <code>console.log</code> but it keeps returning false always, even though it is an empty string(white space).</p>
  
  <p><strong><a href="http://jsfiddle.net/Kritika/1u84b12h/2/" rel="nofollow">Demo</a></strong></p>