fix(curriculum): remove backticks around "ternary operator" (#55996)
parent
838f30e2be
commit
c968c184d6
|
@ -9,7 +9,7 @@ dashedName: step-149
|
|||
|
||||
If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will return a negative number, which will actually add to your total health when fighting a monster! You can fix this issue by using a <dfn>ternary operator</dfn> to ensure negative values are not returned.
|
||||
|
||||
The `ternary operator` is a conditional operator and can be used as a one-line `if-else` statement. The syntax is: `condition ? expressionIfTrue : expressionIfFalse`.
|
||||
The ternary operator is a conditional operator and can be used as a one-line `if-else` statement. The syntax is: `condition ? expressionIfTrue : expressionIfFalse`.
|
||||
|
||||
Here is an example of returning a value using an `if-else` statement and a refactored example using a ternary operator:
|
||||
|
||||
|
|
Loading…
Reference in New Issue