javascript array join method is used to join the elements of an array into a string. Write a simple JavaScript program to join all elements of the following array into a string.
javascript array join
The join() method does not change the original array. also The concat() method is used to merge two or more arrays.The js array join() method combines all the elements of an array into a string and return a new string.
Syntax of array join
array.join(separator);
Java Script Array join()
const websites = ["Pakainfo", "Infinityknow", "W3diy", "Google"]; let text = websites.join();
Example
const websites = ["Pakainfo", "Infinityknow", "W3diy", "Google"]; let text = websites.join(" and ");
Don’t Miss : Array To String Javascript
JavaScript: Join all elements of an array into a string
index.html
Java Script Array join Method - www.pakainfo.com
JavaScript Array join() method
Using the js Array join() method to replace all occurrences of a string
const result = 'Welcome To Pakainfo.com Free Download source code'; const url = result.split(' ') .join('-') .toLowerCase(); console.log(url);
I hope you get an idea about javascript array join.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.