Change H2’s with a certain class to H3

I don’t understand javascript (or jquery) AT ALL so I’m hoping someone can help. I need to change some h2’s into h3’s. I can’t do it at the source as they’re inside a gallery template and cannot be altered.

I only want to target h2’s within this class ‘.collection-668efa708d9ccb52d149b0b1.view-item’

and the h2’s themselves have a class of ‘list-item-content__title’

I’ve looked online and came up with the code below, but as I said, I don’t know what I’m doing. If someone could let me know the correct code I would be very grateful.

<script>
function changeHTMLTag()
{
    var el = document.querySelector('.collection-668efa708d9ccb52d149b0b1.view-item h2.list-item-content__title');
    el.outerHTML = '<h3>' + el.innerHTML + '</h3>';
}