0

I made a simple program that you should type the color it appears on a random word. It works fine in English, but when I tried to "translate" it to my native language I couldn't.

let transl = {
vermelho : "red",
azul:"blue",
amarelo : "yellow",
verde : "green",
branco : "white",
}

I collect his input in my native language var namePT = document.getElementById(...).value; But how can I use this variable? Since it's a string I can't simply use transl.namePT; So how do i convert this string variable to a variable that can be used in the object literal. I hope I didn't make this too confusing or something.

Btw, I'm still new to javascript so give me a break for any stupid mistakes :)

alokagob
  • 73
  • 5

0 Answers0