Every browser has a console where you can type JavaScript and see the result straight away. In Chrome, right-click a page, choose Inspect and open the Console tab.

let name = "Sam";
console.log("Hello " + name);

Try it: open the console and print a message with your own name.