I have an array of string like:
var myArray=['rwt-cable1','rwt-cable42','rwt-cable40',...]
But what I am really interested in is:
['cable1','cable42','cable40',...]
What would be the best way? I'm currently looping through items and extract substrings to get my output array.
myArray.map(..), but yes, ultimately you need to loop and substring/regex-replace or something along those lines.['rwt-cable1', 'rwt-cable42', 'rwt-cable40'].forEach(function(elem, index) { ip[index] = elem.replace('rwt-', ''); });