Javascript String toKebabCase()

Description

Javascript String toKebabCase()


String.prototype.toKebabCase = String.prototype.toKebabCase ||
  function () {/* w  ww . jav  a  2 s  . com*/
    return this.replace(/(.)(?=[A-Z])/g, '$1-').toLowerCase();
  };

Javascript String toKebabCase()

String.prototype.toKebabCase = function () {
  return this.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
};



PreviousNext

Related