title: Converting DOMString to String in javascript
body: <p>I am using javascript to add tooltips for a set of column headers in a displaytag table. I am trying to using an array to map the corresponding description to the header but it's not working.</p>
  
  <pre><code>        var columnHeaderCells = document.getElementById("tableMES").getElementsByTagName("thead")[0].rows[0].cells; 
  
          var myArray = new Array();
          myArray['Seller ID'] = "this is seller ID";
          myArray['Clicks'] = "this is clicks";
          myArray['Sales'] = "this is Sales";
  
          var i = 0;
          while (columnHeaderCells[i]){
  
              var cellText = columnHeaderCells[i].textContent;
              //cellText is not text
  
              //alert(myArray[cellText] + "---" + cellText);
  
              columnHeaderCells[i].setAttribute('title', myArray[cellText]);
  
              i++;
          }
  </code></pre>
  
  <p>The problem seem to be that cellText is not a String but a DOMString object and that's why myArray[cellText] returns null instead of getting the array value I want. If I did:.</p>
  
  <pre><code>myArray['Seller ID']
  </code></pre>
  
  <p>it would return "this is seller ID"</p>
  
  <p>Any tips on dealing with DOMString and String?</p>