I've been googling my little heart out, but I either am asking the wrong question, or it's so obscure it doesn't exists. What I would like to know is can you define a variable with a switch inside it. Things to note about my knowledge of programing and on what level I would understand your answer. I'm a graphic/web designer with only a little experience in js.
Something like this...
var variable = {
switch (case) {
case 'case1':
return "something";
case 'case2':
return "something";
case 'case3':
return "something";
};
};
I know I could just make the switch separate and set the variable per case, but I'm just wondering if this can be done. Also can functions be inside variables? And, how would it be done? Would it be inefficient?