function generateFont() {
var userInput = document.getElementById("getName").value;
var fonts = {
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: ['ฦถ','ศฅ','๐ซ','๐
']
};
var text = "";
for (var i = 0; i < userInput.length; i++) {
var character = userInput.charAt(i);
var randomIndex = Math.floor(Math.random() * fonts[character].length);
text += fonts[character][randomIndex];
}
console.log(text);
}
I'm attempting to convert each character of the input into randomly selected fancy fonts. For example, if the input is "abc", I want to get the value of each spot and convert it to the selected font.
I've encountered some difficulties and crashed a few times during my attempts.