...

/

Booleans, Functions, and Objects

Booleans, Functions, and Objects

In this lesson, you will learn how to declare a variable that can hold true or false.

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.

Press + to interact
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. ...