ES6, CommonJS or Amd
TL;DR doesn’t mather - pick one and use that.
ES6 modules is the future. At some point this will be a part of the language, and then I see no reason not to use that. But we are not there yet. ES-6 modules seems pretty to me. Maybe because they look so much like python. I like them - have never used them for real though.
CommonJs is the way to do modules in node-land. It can be used in the browser as well, if you run it through browserify.
The only module format I have used on larger (frontend-)projects. It works out of the box in the browser, if you have an amd loader present. (Most people use require.js).
Which to choose?
If you were told to only decide upon looking at these three extracts of code - you would probably choose the es6 option. I know I would. Too bad that there are so many other considerations and constraints.
If I were able to choose freely - and not think about legacy stuff - I would choose es6, a transpiler to make my es6-modules into commonjs ones, and then use browserify to create a browser version of that…. But then again - I love complex build scripts to make simple stuff….