title: How to put If condition in array for data table in JavaScript?
body: <p>I am implementing datatable this table contain all row with one API hit. And I want to put condition in java script code. Data table creating through java script. I am sharing my code sample.</p>
  
  <pre><code>$scope.standardOptions = DTOptionsBuilder
     .fromFnPromise(R.all('----api call--').getList())
     .withDOM("&lt;'dt-toolbar'&lt;'col-xs-12 col-sm-6'f&gt;&lt;'col-sm-6 col-xs-12 hidden-xs'l&gt;r&gt;" +
     "t" +
     "&lt;'dt-toolbar-footer'&lt;'col-sm-6 col-xs-12 hidden-xs'i&gt;&lt;'col-xs-12 col-sm-6'p&gt;&gt;")
     .withBootstrap();
  
  $scope.standardColumns = [               
     DTColumnBuilder.newColumn('flightNo').withOption('defaultContent', '-'),
     DTColumnBuilder.newColumn('eta').renderWith(dataRendererETA).withOption('defaultContent', '-'),
     DTColumnBuilder.newColumn('etd').renderWith(dataRendererETA).withOption('defaultContent', '-'),        
  ];
  </code></pre>
  
  <p><strong>API Call DATA</strong></p>
  
  <pre><code>    {
      "_id": "101-87450458_2016_SEP",
      "flightNo": "087",
      "eta": {
            "$date": 1511868720000
            },
      "etd": {
           "$date": 1511875800000
          },
      }
  </code></pre>
  
  <p>I want to put if condition in second and third DtColumnBuilder. If either eta should print or etd.</p>
  
  <p>I am new in datatables. How can I put condition.</p>
  
  <blockquote>
    <p>DTColumnBuilder.newColumn('eta').renderWith(dataRendererETA).withOption('defaultContent',
    '-'),
               DTColumnBuilder.newColumn('etd').renderWith(dataRendererETA).withOption('defaultContent',
    '-'),</p>
  </blockquote>
  
  <p>I want to display one at a time.</p>
  
  <p><a href="https://i.stack.imgur.com/XcDyl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XcDyl.png" alt="enter image description here"></a></p>