function setup(){
createCanvas(250,250);
background(255);
noStroke();
}
function draw(){
for(let y=0;y<=250;y+=20){
for(let x=0;x<=250;x+=20){
fill(0);
rect(x,y,10,10);
}
}
for(let y=10;y<=250;y+=20){
for(let x=10;x<=250;x+=20){
fill(0);
rect(x,y,10,10);
}
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js"></script>