You can look at that POST here that contains a project with an example of JS to encode/decode in base64.
You can call your variable extractor value using the "context.variableManager.getValue("myVar")" and the concatenation is straightforward like this:
my value = "foo" + context.variableManager.getValue("myVar") + context.variableManager.getValue("myVar2");