Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Advanced Concatenator (GEJS)
// This fails with ["a,,", "b"] Do you know how to fix it? We'll see how to in class
var concatenator = function(arr, optSeparator) {
if(!arr || typeof(arr.join) != 'function')
var separator = typeof(optSeparator) == 'string' ? optSeparator : ',';
var r = arr.join();
if(separator != ',')
r = r.replace(/,/g, separator);
return r;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.