Hey everyone :) How can I place if statements between a split string? Obviously I can make it like that:
if(lang == 'eng'){
var a_string = 'hello';
}else if(lang == 'ger'){
var a_string = 'hallo';
}
but that's too long for some situations. What came in my mind was the following:
var lang = (e.g. 'ger' or 'eng');
var a_string = 'h' + if(lang == 'eng'){'e'}else if(lang == 'ger'){'a'} + 'llo';
Is there a way to write if statements between a split string?
Aucun commentaire:
Enregistrer un commentaire