How to run JavaScript program in browser?

How can we run a JavaScript program in web browsers ?

Google Chrome or any other chromium-based browsers provides a developer console that can be used to run JavaScript code.

You can use Cmd + Option + J on Mac or Ctrl + Shift + J on windows or linux to open the Developer console. Then you can write your JS code in that console :