Last active
September 1, 2018 00:57
-
-
Save amyhenning/a96431affc31b590095a82b7af9b2b80 to your computer and use it in GitHub Desktop.
Built the join method using JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _ = { | |
join: (array, separator = ',') => { | |
var newString = array.toString(); | |
if (separator) { | |
var replaced = newString.replace(",", separator); | |
} | |
console.log(replaced); | |
} | |
} | |
const value = _.join(["hello", "goodbye"], "...") | |
console.log(value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment