Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Testing to see if an argument has been omitted
function joinArray(arr, separator) {
// if (typeof separator === "undefined") {
// if (separator === undefined) {
// if (arguments.length === 1) {
if (separator == null) {
separator = " - ";
}
return arr.join(separator);
}
joinArray([1, 2, 3]) // "1 - 2 - 3"
joinArray([1, 2, 3], ", ") // "1, 2, 3"
joinArray([1, 2, 3], "") // "123"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.