That is, it works - but what is with the repeated class declaration for every h3 element?
<h3 class="text-xl font-bold mb-2">1. Pruning</h3>
The whole point of CSS is to have to declare properties like this once, and only once, for a group of functionally similar elements.Also note that switchTab has to be told the position of the tab it's switching to (it should be able to infer that the element's id, or its position in the list). Also note that the function has a hard-coded tab count baked in - a stealth bug waiting to be tripped on.
And why do we need to explicitly toggle the border-b-2 and border-yellow-400 properties? Shouldn't these be tucked away under some kind of class declaration (the same way the hidden property works)?
This may sound like nitpicking, but it's not - code like this becomes really hard to maintain at scale.
And just imagine someone asking this thing to generate an algorithm to say, determine whether someone's medical procedure should be covered under insurance or not.