title: How to remove empty columns in 2D Array in Javascript efficiently
body: <p>I have following array of arrays (2D Array)</p>
  
  <pre><code>Input    csvData = [["", "2", "",  ""], ["", "3", "", ""], ["", "", "4", ""]]
  </code></pre>
  
  <p>How to remove empty columns from above array.</p>
  
  <pre><code>   Output   csvData = [[ "2", ""], ["3", ""], ["","4"]]
  </code></pre>
  
  <p>I am trying but not able to complete.</p>
  
  <pre><code>  removeEmptyColumns(csvData) {
      for (let i = 0; i &lt; csvData.length; i++) {
        let col = csvData.map(function (value, index) { return value[i]; });
        for (let j = 0; j &lt; col.length; j++) {
          if (col[j])
            break;
        }
  
      }
  
    }
  </code></pre>