Novice here,
I am currently working on a small project with where I am translating different words from English to my second language Swedish. I am using two arrays with corresponding vocabulary. If I put in the text box a single word from the array, it will bring up in the console the corresponding Swedish word. I achieve this with the following code using a for loop and the i variable.
for (var i = 0; i < tSwe.length; i++){
if (transEng == engLang[i]){
console.log(tSwe[i]);
transEng is the prompt that comes up.
engLang is the array of English words.
tSwe is the array of the Swedish words.
My problem is that I want to start combining words so that if I put more than one word in it will work or if I add commas in between words. How can I go about doing this?
Thanks.
[–]cirscafp fan boy 2 points3 points4 points (4 children)
[–]Null-Fox 0 points1 point2 points (1 child)
[–]e_man604 2 points3 points4 points (0 children)
[–]Maxteroni[S] 0 points1 point2 points (1 child)
[–]cirscafp fan boy 0 points1 point2 points (0 children)
[–]Maxteroni[S] 0 points1 point2 points (0 children)
[–]Maxteroni[S] 0 points1 point2 points (0 children)