we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "multiple ternary operator javascript"
Sarah
11 Feb 2016
1// Use Multiple Conditional Ternary Operators Javascript.
2
3
4function checkSign(num) {
5
6	return num > 0 ? "positive" : num < 0 ? "negative" : "zero";
7
8}
9
10console.log(checkSign(10));
11console.log(checkSign(-10));
12console.log(checkSign(0));
Irene
16 Jan 2018
1var icon = (area == 1) ? icon1 : (area == 2) ? icon2 : icon0;