Browse - Programming Tips - How can I print from the command line js (javaScript) interpreter?

Date: 2016may11
Language: javaScript
OS: Linux

Q.  How can I print from the command line js (javaScript) interpreter?

A.  Use putstr()

#!/usr/bin/js function sayHello() { putstr("hello\n"); } sayHello();
Its called SpiderMonkey. More info https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell To install on RedHat/Fedora/CentOS
dnf install js