setup()
setup() runs once when the sketch starts. It's the perfect place to initialize your canvas and set up any starting values. Using windowWidth and windowHeight instead of fixed numbers makes your sketch adapt to any screen size.
function setup() {
createCanvas(windowWidth, windowHeight);
}
Line by Line:
createCanvas(windowWidth, windowHeight)- Creates a canvas that fills the entire browser window by using windowWidth and windowHeight variables. This makes the sketch responsive to different screen sizes.