UNPKG
ifd
Version:
%s (0.0.3)
latest (0.1.0)
0.1.0
0.0.3
0.0.1
Life Extending Ternary Operator Abstractions
github.com/artisin/ifd
artisin/ifd
ifd
/
__tests__
/
doc-examples
/
the-ternary-abstraction
/
nested-ternary-problem.md
12 lines
(10 loc)
•
244 B
Markdown
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
__The Nested Ternary Problem__ ```js
const
one =
false
;
const
two =
false
;
const
three =
true
;
// while this gives us the desired outcome the
// logic is hard to reason about
const
foo = one ?
1
: two ?
2
: three ?
3
:
4
;
// foo === 3
```