Where could I find examples of what I'm trying to achieve?

I want the JS insert a <span> within an <h2>

I've had no luck with createElement and appendChild