Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Node.js join() function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

join() is an array function from Node.js that is used to return a string from the array. 

Syntax:

array_name.join(parameter)

Parameter: This function takes a single parameter as per which the join operation has to be performed. 

Return type: The function returns the string. 

The program below demonstrates the working of the function: 

Example 1: 

javascript




function joinDemo() {
    const str = arr.join("*");
    console.log(str);
}
const arr = [17, 55, 87, 49, 78];
joinDemo();


Output:

17*55*87*49*78

Example 2:  

javascript




function joinDemo() {
    const str = arr.join("");
    const str1 = arr.join("$");
    console.log(str);
    console.log(str1);
}
const arr = ['C', 'Java', 'Python'];
joinDemo();


Output:

CJavaPython
C$Java$Python
My Personal Notes arrow_drop_up
Last Updated : 30 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials