How to use Array join() Method In Javascript
The JavaScript Array join() Method is used to join the elements of an array into a string. The elements of the string will be separated by a specified separator and its default value is a comma ( , ).
Syntax:
array.join( separator )
Example: In this article we will concate strings present in an array.
// JavaScript program to join Strings
// using array join() method
let arr = ['Geeks', 'for', 'Geeks'];
// Joining the strings using
// join() method
let str = arr.join('');
console.log(str);
Output
w3wiki
How to Concatenate Strings in JavaScript ?
String concatenation refers to combining multiple strings into a single string. This operation is commonly used in programming to create dynamic strings by joining text fragments or variables.
Approaches to Concate String in JavaScript:
Table of Content
- Using String concat() Method
- Using JavaScript + Operator
- Using JavaScript Array join() Method
- Using Template Literals (Template Strings)