Created
November 12, 2017 09:40
-
-
Save adi518/601f86b5bc9d5d3ed6d3e36d05ad6871 to your computer and use it in GitHub Desktop.
This file contains 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 generateClassName (amountOfLettersInClassName) { | |
amountOfLettersInClassName = amountOfLettersInClassName || 9; | |
var className = []; | |
for (var i = 0; i < amountOfLettersInClassName; i++) { | |
var charCodeOffset = 65; | |
var numeral = Math.round(Math.random() * 25) + charCodeOffset; | |
var letter = String.fromCharCode(numeral); | |
className.push(letter); | |
} | |
className = className.join('').toLowerCase(); | |
return className; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment