windowWidth and windowHeight sometimes results in a scrollbar

I'm using p5.js windowWidth and windowHeight to automatically resize my canvas to fit the screen, but sometimes the resulting canvas does not fit exactly in the screen and results in a scrollbar. Any idea how to make the canvas fit exactly?

Code:

function windowResized() { resizeCanvas(windowWidth, windowHeight); } function setup() { createCanvas(windowWidth, windowHeight); } 

Edit: Well, you can just hide the scrollbar with document.body.style.overflow = 'hidden';, but that's kind of hackish.

submitted by /u/skeptical_moderate
[link] [comments]