JSFiddle - React, Tailwind, and code Playground

HTML

<ol id="list">
  <li>6</li>
  <li>3</li>
  <li>1</li>
  <li>4</li>
  <li>7</li>
  <li>4</li>
  <li>2</li>
  <li>8</li>
  <li>9</li>
  <li>2</li>
</ol>

JavaScript

/*
Write an algorithm that will find the first duplicate in a list on the page.
For example we would return 4, for the list above.
*/