how to upgrade javascript version code example

Example 1: how to update node js version

//check node version
>node -v
// let's install a program called n that will let us easily switch 
//between Node versions.
>npm install -g n
//Upgrading to the latest stable version
>n stable 
//Changing to a specific version
>n 10.16.0

Example 2: update node with nvm

// to see which versions of node you have run:
nvm ls

// example:
// nvm ls
//         v8.10.0
// ->      v8.16.0
//       v10.21.0
//         system
// default -> 8.16.0 (-> v8.16.0)

// in this case use
nvm use 10.21.0

// you can also uninstall and reinstall if you are having issues
// by following the steps in:
// https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/