function translate(){ // Task: // - Write a function to display the correct greeting when a language is selected. let langObj = greetingsArr.find(item => item.language === languageSelector.value) greetingDisplay.innerText = langObj.greeting }
// Stretch goals: // - Animate the message switch. // - Add the option to switch the greeting, for example also have "And a Happy New Year!".
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
1
2
3
4
5
6
7
8
9
10
11
12
13
{
language:"Ukrainian",
greeting:"щасливого Різдва!"
},
{
language:"Welsh",
greeting:"Nadolig Llawen!"
}
]
function translate(){
// Task:
// - Write a function to display the correct greeting when a language is selected.
let langObj = greetingsArr.find(item => item.language === languageSelector.value)
greetingDisplay.innerText = langObj.greeting
}
// Stretch goals:
// - Animate the message switch.
// - Add the option to switch the greeting, for example also have "And a Happy New Year!".