how to respawn Enemies and Targets

I’m almost done! all I need to do is to add code to respawn enemies and targets to this game in JavaScript.
Anyone have any ideas? there aren’t many sources with the kind of code I’m looking for.

Replit: Join AnaeliRivera's "EnemyGame " - Replit

One of the best YT channels for JS game dev is
https://www.youtube.com/@Frankslaboratory

check out Performance optimisations
and State mangement

I’ve used both finite state machines and the object pool method for a few projects and the performance is great…

Hmmm, I have seen his videos; they did help. however not for this particular instance.
But I do want some thoughts on how I should go about this.

Should I refresh the whole page seconds after defeating the last enemy or should I have an enemy spawn right after one is deleted?

I’m asking because I already have this code:

setInterval(()={
  window.location.reload()
},2000) // Reload after 2 seconds

Of course, I can just go the easy way and just refresh the page in 2 seconds.

Or the more practical but difficult way.

What are your thoughts and advise if any?