NodeJS by Example: Hello World

Our first program will be the standard hello world message

function helloWorld() {
  return 'Hello World!';
}
helloWorld();

Make sure you have NodeJS installed

$ which node
# /usr/local/bin/node

You can then run it from the command line

$ node ./helloworld
# hello world