In need to check three conditions and assign a value to a variable according the condition.
if(a =="z1"){
b = "one";
} else if(a =="z2"){
b = "two";
} else if(a =="z3"){
b = "three";
}
Is it possible to do it in JavaScript using ? : statement to make it as a single line code
b=['one','two','three'][a[1]-1]