Remove Duplicate Elem From Array

by Venkatesh Dematti

HTML

<h2>Algo complexity is log(n)</h2>

JavaScript

let array1 = [0,1,2,3,4,5,6,1,7,8,0,3,2];

let array2 = [];

let len = array1.length;

array1.sort();

let _temp; 

for(let x=0; x<len ; x++){
  
  if(array1[x] !== _temp){
     array2.push(array1[x]);
     _temp = array1[x];
  }
}

console.log(array2);

console.log(5 < 6 < 7);

console.log(7 > 6 > 5);