Making Decisions
7 min · TypeScript
Run different code depending on whether something is true.
TypeScript · Making Decisions0/5 cleared
Enemy 1 of 5
An if runs its { } block only when the condition evaluates to true; else covers everything else, so exactly one of the two blocks runs. Compare values with > , < , >= , <= , and === (strict equality, checking both value and type).
TypeScript, like modern JavaScript, favors === over == for comparisons — === never tries to convert one type to another to force a match, so the result is always predictable. Because temperature here is explicitly typed as number, TypeScript also guarantees you can never accidentally compare it against something incompatible without at least being warned.
You
Memory-Leak Rat
Loading editor...
Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: Cold