i already tried this:
let x = document.createElement('p');
let y = document.createTextNode('Hello world');
x.appendChild(y);
document.body.appendChild(x);
why doesn't this work?
You should not use createTextNote, instead use:
let x = document.createElement('p');
x.innerHtml = /* your text */;
document.body.appendChild(x);
x.innerHtml sets the inner content of your p element, in this case it is some text.