I am making a word game that picks 8 random letters from the alphabet and the player must find words that use these letters. I am trying to find out how to stop it from showing duplicate letters.
Here is the code I am using to pick the letters
function makeid(length) {
var result = '';
var characters = 'aaabcdeeefghiiijklmnooopqrstuuuvwxyz';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
console.log(makeid(8));