0 of 5 problems solved0%
3 of 5

Boolean Inference

TypeScript can also infer boolean values without you explicitly writing :boolean.

If you assign a variable to either true or false, TypeScript automatically knows its type is boolean.

In this exercise, you'll combine a calculation with a boolean check.

Your Task

  • Assign isExpensive a value that checks if buying 10 apples (each costing 5) costs more than 40.
  • Run the code and observe in the console how the type changes when you give it a value.

Example Output

boolean true

Hints

  • The > operator returns a boolean.