Answers for "8.3.1. Common Array Methods // join Examples (.join)"

0

8.3.1. Common Array Methods // join Examples (.join)

//The general syntax for this method is:
arrayName.join('connector')

/*join combines all the elements of an array into a string. The 
connector determines the string that "glues" the array elements 
together.*/

let arr = [1, 2, 3, 4];
let words = ['hello', 'world', '!'];
let newString = '';

newString = arr.join("+");
console.log(newString);

newString = words.join("");
console.log(newString);

newString = words.join("_");
console.log(newString);

//1+2+3+4
//helloworld!
//hello_world_!
Posted by: Guest on June-16-2021

Code answers related to "8.3.1. Common Array Methods // join Examples (.join)"

Code answers related to "Javascript"

Browse Popular Code Answers by Language