title: how to make html class conditional using ternary operator in javascript
body: <pre><code>for (var i = 0; i &lt; data.getmsg.length; i++) {
      getMessages += '&lt;div class="row"&gt;&lt;div class="col-xs-12'          
  data.getmsg[i].user_id_fk == user_id ? 'pull-right user-one' : 'pull-left user-two"&gt;'+ data.getmsg[i].reply +'&lt;/div&gt;&lt;/div&gt;'; 
     }
  </code></pre>