title: this code is supposed to delete duplicate values and delete empty spaces but it is deleting unique values as well
body: <p>this code is supposed to delete duplicate values and delete empty spaces but it is deleting unique values as well. </p>
  
  <pre><code>cnt = 0;
  for (let i = 0; i &lt; this.fin.length; i++) {
      for (let j = 0; j &lt; this.fin.length; j++) {
          if (this.fin[i] == this.fin[j]) {
              cnt++;
              if (cnt &gt; 1) {
                  this.fin[j] = '';
              }
          }
          if (j == this.fin.length - 1) {
              cnt = 0;
          }
      }
  }
  this.ntmtg1 = true;
  count = 0;
  for (let j in this.fin) {
      if (this.fin[j] == '') {
          this.fin.splice(parseInt(j));
      }
  }
  </code></pre>