The join() method of an array returns a string by concatenating all of the elements in the array separated by commas or a specified string.

    
    const states = ['Idaho', 'Texas', 'Maine'];

    const result = states.join();
    console.log(result);
    // "Idaho,Texas,Maine"

    const result1 = states.join('-');
    console.log(result1);
    // "Idaho-Texas-Maine"