Javascript String snake_case()

Description

Javascript String snake_case()


String.prototype.snake_case = function(){
    return this/* w  w w.j  a v  a2s  . co m*/
        .replace( /[A-Z]/g, function($1) { return '_' + $1 } )
        .toLowerCase();
}



PreviousNext

Related