mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
16 lines
393 B
JavaScript
16 lines
393 B
JavaScript
const MakeRandomString = (length) => {
|
|
|
|
let result = '';
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
const charactersLength = characters.length;
|
|
|
|
for ( var i = 0; i < length; i++ ) {
|
|
|
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export default MakeRandomString
|