move second word to the end
How do I do that (even in regex)? I´ve been hours trying to find out...
thanks in advance
thanks in advance
Reply to #1:
I've found myself what I needed to solve the situation.
I've found myself what I needed to solve the situation.
Reply to #2: Would be nice to know how you did it.
Reply to #3:
Had a similar requirement the other day, did it like this:
```javascript
//function (index, item) {
function swapElements(array, index1, index2){
var temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
};
const name_arr = item.name.split('_');
swapElements(name_arr, 0, 1);
return name_arr.join("_");
//}
```
Had a similar requirement the other day, did it like this:
```javascript
//function (index, item) {
function swapElements(array, index1, index2){
var temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
};
const name_arr = item.name.split('_');
swapElements(name_arr, 0, 1);
return name_arr.join("_");
//}
```