Javascript String swap_chars(i,j)

Description

Javascript String swap_chars(i,j)


String.prototype.swap_chars = function(i,j) {
    var array_string = this.split("");
    tmp = array_string[i];// ww w  .j  a va  2 s . co m
    array_string[i] = array_string[j];
    array_string[j] = tmp;
    return array_string.join("");
};



PreviousNext

Related