added nested ternary expression

pull/887/head
Ayush 3 years ago
parent 120204995f
commit 644b7c45a1

@ -130,6 +130,18 @@ if (!condition) {
let variable = condition ? <return this if true> : <return this if false> let variable = condition ? <return this if true> : <return this if false>
``` ```
- Nested Ternary expression:
```javascript
let variable = condition ? <return this if true> :
<return this if 1st condition is false but this condition is true> :
<return this if first two conditions are false>
```
- Better to use if..else statements if there are 3 or more conditions.
Below is a more tangible example: Below is a more tangible example:
```javascript ```javascript

Loading…
Cancel
Save