-
-
Save darwinsalinas/e70d0178b3abdb68e93f308f433a19c0 to your computer and use it in GitHub Desktop.
Javascript convert camelcase to dash (hyphen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function camelCaseToDash( myStr ) { | |
| return myStr.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase(); | |
| } | |
| var myStr = camelCaseToDash( 'thisString' ); | |
| alert( myStr ); // => this-string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment