Example how to display the value of a variable on the screen?

does anyone have an example how to display the value of a variable on the screen? I can’t do it, even though I tried pure javascript

Just set text, like this.