function clear() p5js how das this work

JavaScript
let myDiv = createDiv('this is some text');
myDiv.remove();
Source

Also in JavaScript: