Skip to content
Related Articles

Related Articles

Improve Article
Node.js | join() function
  • Last Updated : 30 Aug, 2019

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:
Program 1:






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

Output:

17*55*87*49*78

Program 2:




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

Output:

CJavaPython
C$Java$Python
My Personal Notes arrow_drop_up
Recommended Articles
Page :