Digital Clock Script
1
You are repeating condition ? '0' + integer : integer 3 times.
This can be reduced with const zeroPad = (num, places) =&gt; String(num).padStart(places, '0')
and doing
  hours = zeroPad(hours, 2);
  minutes = zeroPad(minutes, 2);
  seconds = zeroPad(seconds, 2);

The 2 is now a repeated magic number and you may wish to store it in a variable with a descriptive name.
2
&lt;script src = &quot;script.js&quot;&gt;&lt;/script&gt;
Usually, there are no spaces around the equals sign:
&lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;
3
I'm not familiar with JavaScript, but I would replace the nested setTimeout:
function showTime() {
  // ...
  setTimeout(showTime, 1000)
}

with a setInterval:
setInterval(showTime, 1000);
I would also place a space after the comma.
4
For formatting the time, take a look at this answer which suggests using:
hours = hours % 12;
hours = hours ? hours : 12;

5
You use document.querySelector('div') but this &quot;returns the first Element within the document that matches the specified selector&quot;.
I would suggest using &lt;div id=&quot;...&quot;&gt;&lt;/div&gt; and document.getElementById