JSFiddle - React, Tailwind, and code Playground

by Sanjay Yadav

HTML

<h1>
 Find First Duplicate in a List of numbers
</h1>

CSS

h1 {
  color: blue;
}

JavaScript

const dupliate_list =[1, 2, 4, 10, 6, 7, 10];
/* 
const dup = dupliate_list.filter((x, index) => index !== dupliate_list.indexOf(x));

console.log(dup); */
var hashtable = [];
var temp = [];
for(var i=0; i<dupliate_list.length; i++){
	if(!hashtable[i] === undefined){
  	temp.push(dupliate_list[i])
  } else {
  	hashtable[i] = dupliate_list[i]
  }
}