Using variables and functions across .js files

anyone got a good resource on importing and exporting functions or variables from one file to another?
like if i defined an object A = {} in one file how would I export, import it and use it in a different file