Shorthand with else if

Viewed 520

How do I write shorthand for else if statements?

if (showvar == "instock"){
   //show available
} else if (showvar == "final3"){
  //show only 3 available
} else {
  //show Not available
}

I know to write when there's only if and else. But How do I write this when there's an else if statement?

(showvar == "instock")? //show available : //show Not available
1 Answers
Related