what does the "-g" flag do in the command "npm install -g <something>"?

I'm following examples that use the -g flag when using npm install but I can't figure out through the help system what the -g flag is doing.

-g tells npm to install the named module so that it's accessible globally.

See the docs here.

If you do npm help install you will see that:

  o   npm install (in package directory, no arguments):

      Install the dependencies in the local node_modules folder.

      In global mode (ie, with -g or --global appended  to  the  com-
      mand), it installs the current package context (ie, the current
      working directory) as a global package.

Take the express module as an example. If it was previously installed with the -g option, you could write express anywhere, to create a skeleton application.