When working with GopherJS, an interesting use case is writing code modules in Go that are then expected to be used by JavaScript module.
Before we explore how to export JavaScript modules that originated from Go code, let's go through some vanilla JavaScript code in order to gain a simple understanding of how module exporting works in the language.
Inside our node folder, create a new folder called calc. In that folder, we'll write a simple JavaScript module that will allow us to add and/or subtract some numbers.
Inside the calc folder, create a file called addsub.js. There, we'll create two functions, add() and sub():
function add(i,j){ return i+j;}function sub(i,j){ return i-j;}
The next step needed is to export these