There is an array

var array = ["qwe", "asd", "zxc"]; 

At the exit you need to get a full mirror response. those.

"cxz", "dsa", "ewq"

I know how to deploy the array, I did it, but I don’t quite understand how to turn the lines. There is such a solution:

 var array=["qwe", "asd", "zxc"]; var a = array.reverse(); 

But I don’t know what to do with strings, please tell me the solutions.

I know that it is necessary to go through the array and each element of the array (line). Expand, expand the array and connect back to the string, but I don’t understand how to implement it.

    2 answers 2

    Something like this:

     var a = ["qwe", "asd", "zxc"]; var b = a.reverse().map(function(aa){ return aa.split("").reverse().join(""); }); console.log(b); 
    • Thank! Gave clarity - Sergey Glazov

    Assuming that there cannot be exactly, say, a zero \0 in the lines, you can glue everything into one line through this separator, reverse it, and break it down

     var a = ["qwe", "asd", "zxc"]; var d = "\0"; var b = a.join(d).split('').reverse().join('').split(d); // ["cxz","dsa","ewq"] 

    Disadvantage of the delimiter method: strings should not exactly contain this character.

    • And this option is good, I agree, thanks - Sergey Glazov