Computer Science, asked by mohammedrafiahpbpdzn, 9 months ago

Write a simple JavaScript program to join all elements of the following array

into a string.

Sample Input array : myColor = [“Red”, “Green”, “White”, “Black”];

Expected Output :

“Red,Green,White,Black”

“Red,Green,White,Black”

“Red+Green+White+Black”​

Answers

Answered by Anonymous
0

Explanation:

JavaScript: Join all elements of an array into a string

Sample Solution:

HTML Code: <! ...

JavaScript Code: myColor = ["Red", "Green", "White", "Black"]; console.log(myColor.toString()); console.log(myColor.join()); console.log(myColor.join('+')); ...

ES6 Version: ...

Live Demo:

Similar questions