title: Using a ternary operator to set a variable
body: <p>I am trying to use a ternary operator to check if the value of an XML element is null. If it is then I want the variable to be one thing. If not then I would like it to return the value of element. This is what I have so far. </p>
  
  <pre><code>var rating = data.getElementsByTagName("overall_average")[0].childeNodes[0].length &gt; 0 ? data.getElementsByTagName("overall_average")[0].childeNodes[0].nodeValue : "It is empty";
  </code></pre>