Write a simple JavaScript program to join all elements of the following array into a string.
-
Sample array : myColor = ["Red", "Green", "White", "Black"]; Expected Output : "Red,Green,White,Black" "Red,Green,White,Black" "Red+Green+White+Black"
-
Sample array : var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3]; Sample Output : a ( 5 times )
-
Test Data : console.log(truncateString("Robin Singh",4)); OUTPUT: "Robi"
-
Test Data : console.log(capitalizeWords('js string exercises')); OUTPUT: "Js String Exercises"
-
e.g arrBetween(3, 8, [1, 5, 95, 0, 4, 7]) ➞ [5, 4, 7] arrBetween(1, 10, [1, 10, 25, 8, 11, 6]) ➞ [8, 6] arrBetween(7, 32, [1, 2, 3, 78]) ➞ []
-
e.g findIndex(["hi", "edabit", "fgh", "abc"], "fgh") ➞ 2 findIndex(["Red", "blue", "Blue", "Green"], "blue") ➞ 1 findIndex(["a", "g", "y", "d"], "d") ➞ 3 findIndex(["Pineapple", "Orange", "Grape", "Apple"], "Pineapple") ➞ 0