user5471528 user5471528 - 6 months ago 5x
Javascript Question

How do I get an array of substrings from an array of strings?

I have an array of string like:

var myArray=['rwt-cable1','rwt-cable42','rwt-cable40',...]

But what I am really interested in is:


What would be the best way? I'm currently looping through items and extract substrings to get my output array.


Simpler would be

var myArray=['rwt-cable1','rwt-cable42','rwt-cable40']>x.replace('rwt-',''));
//["cable1", "cable42", "cable40"]