I tried to use browsers' console, but it interprets print as command to print a document, not as output on the console. I heard about some JavaScript Shell, but didn't quiet get how to install and use it. I need to run just trivial console Javascript programs.

  • 3
    In JS, console.log is for output, not print. – Ray Wu Dec 6 '20 at 19:36

The easiest way to run JavaScript on your desktop is probably thorugh NodeJS. Install it with:

apt install nodejs

Then if you create a file named hello.js like this...


...you can execute it like this:

$ node hello.js

NodeJS comes with several modules for various tasks, including interacting with your desktop and creating graphical applications. Use apt search ^node- to list those packaged for Ubuntu, or check out NPM for many other third-party packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.