var a = ["a","b"];
var b = ["c","d"];
var c = ["e","f"];
So these are the three arrays. I want the output as: var d = [a-b:c-d:e-f];
How can it be acheived either using javascript or jquery?
var a = ["a","b"];
var b = ["c","d"];
var c = ["e","f"];
So these are the three arrays. I want the output as: var d = [a-b:c-d:e-f];
How can it be acheived either using javascript or jquery?
You can do it using a map and joins
var d = [ a, b, c ].map(sub => sub.join("-")).join(":");
The first map takes every subarray and joins them (d is ["a-b", "c-d", "e-f"]
), then the last join creates a string out of them by joining the strings using colons.