Ok, We aren't talking about the same thing. The games you linked change the resolution when you full screen. I'm trying to down scale the resolution when the screen/browser is smaller (as I mentioned originally). I should have phrased the title of the post better and more clearly state I'm trying to downscale my games resolution.
The way you're doing it seems more complicated than is necessary. Are you using some sort of 3rd-party framework?
What specifically seems more complicated? I'm using p5.js its a JavaScript library.
Images illustrating the issue: