join method in node js code example

Example 1: js join

//turns array to string

const elements = ['Fire', 'Air', 'Water'];

console.log(elements.join());
// expected output: "Fire,Air,Water"

console.log(elements.join(''));
// expected output: "FireAirWater"

console.log(elements.join('-'));
// expected output: "Fire-Air-Water"

Example 2: javascript join list of string

// array.join(separator)

var myArray ['foo', 'bar', 'baz'];
myarray.join(':');
// foo:bar:baz

Example 3: join method in express

app.use('/static', express.static(path.join(__dirname, 'public')))