Not sure if it’s a genuine question but I’ll try to answer, I think when worms detect vibration they associate it as rain, that is why they go up ground to prevent drowning.
Edit: I got curious and it turns out my assumption was false, looks like it might be because it’s easier to migrate, then there is also to avoid predator.
https://www.scientificamerican.com/article/why-earthworms-surface-after-rain/
JS is basically the Hydra from the Greek Mythology.
Though PHP is literally the problem had me lol.