Skip to content

Instantly share code, notes, and snippets.

@cefaijustin
Created May 27, 2018 18:47
Show Gist options
  • Save cefaijustin/592f0cf091100bcf506d4c9d859be3a5 to your computer and use it in GitHub Desktop.
Save cefaijustin/592f0cf091100bcf506d4c9d859be3a5 to your computer and use it in GitHub Desktop.
Ta daa.
"use strict";
var _ = {
join: (array, separator = ",") => {
var str = "";
for (var i = 0; i < array.length; i++) {
str += separator + array[i];
}
return str.substring(2);
}
}
const value = _.join(["hello", "goodbye"], " , ")
console.log(value);
const value2 = _.join(["dogs", "cats", "birds"], " + ")
console.log(value2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment