Sobes.tech
Intern — Senior

Creating a string concatenation function with a separator

livecode

Task condition

It is required to implement the method str.join, which takes a separator and an arbitrary number of strings, joining them through the specified character.

function str.join() {  
    // code here  
}  

console.log(str.join('.', 'a', 'b', 'c')) // 'a.b.c'  
console.log(str.join('-', 'a', 'b', 'c', 'd', 'e', 'f')) // 'a-b-c-d-e-f'