This example is very out of date
You require the use of an oAuth token to call helix with.
Which (generally speaking) will require a backend server in order to make the helix call whilst protecting your secrets.
A front end would call a backend and the backend then generates or uses and existing token to lookup streams.
You would generally use an “App Acces Token” AKA “Client Credentials” for server to server requests Getting Tokens: OAuth | Twitch Developers
A “pure” front end example, like what you linked, only works if you ask the user to login vai Implict Auth in order to make calls to Twitch.
But this generally you don’t want to do, since users don’t want to have to login to use your site first.