Search⌘ K

Booleans, Functions, and Objects

Explore boolean primitives, functions, and objects in TypeScript. Understand case sensitivity in booleans, the use of truthy and falsy values, and how Boolean functions convert different types. This lesson guides you through key concepts and common behaviors in boolean handling.

Boolean primitive type

A boolean value is the most basic primitive in JavaScript and it remains the same with TypeScript. Boolean values restrict the assignment to two values: true and false. These terms are case sensitive – only the lowercase format is accepted.

TypeScript 3.3.4
let b: boolean = true;
console.log(b);

You cannot assign the value 0 or 1, or the true or false values using any upper case letters. ...