answersLogoWhite

0


Best Answer

function generateRandomLetter()

{

var theLetters=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];

//You can change theLetters to include whatever characters you want the function

//to pick from. You can even change its values to numbers!

return theLetters[Math.floor(Math.random()*theLetters.length)];

//Math.floor truncates the number passed in to the decimal point, and

//Math.random returns a random number each time it is called.

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you do javascript random letter?
Write your answer...
Submit
Still have questions?
magnify glass
imp