Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert an array to string javascript

// convert an array to string javascript
// using reduce()
let array = ['A', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'];
let output = array.reduce((a, b) => a + ' ' + b);
console.log(output); //A quick brown fox jumps over the lazy dog

// using join()
let output1 = array.join(" ");
console.log(output1); //A quick brown fox jumps over the lazy dog
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #array #string #javascript
ADD COMMENT
Topic
Name
4+6 =