How do I change the font in a website using Javascript? [closed]

This is code I’m using right now:

let h2 = document.getElementsByTagName("span");
for (let i = 0; i < h2.length; i++) {
    h2[i].innerText = "hello";
    h2[i].style.fontFamily = 'Roboto', sans-serif;
}

but I’m getting an error.

I am able to change the .innerText to "hello" for the `’ tags, but I’m not able to change the font inside. Please help 🙂