Javascript String cssRulesToJsEquivalent()

Description

Javascript String cssRulesToJsEquivalent()


String.prototype.cssRulesToJsEquivalent = function() {
  return this.replace(/\-[a-z]/ig, function(s){return s[1].toUpperCase();});
}
var str = "border-Top-left-Radius";
str = str.cssRulesToJsEquivalent();/*from ww w.  ja va2 s .com*/
console.log(str);



PreviousNext

Related