When using the language C
, we can easily change two characters of a string place, just do:
aux = str[i];
str[i] = str[j];
str[j] = aux;
For example: "ABCD" would be "ABDC"
However, I'm having a hard time doing this using javascript. Does anyone know a method that does just that?