Complete the code to declare a boolean variable with value true.
let isActive: boolean = [1];The boolean type in TypeScript accepts only true or false as values, not strings or numbers.
Complete the code to check if the variable is false.
if ([1] === false) { console.log("It is false"); }
isActive === false === false.!isActive when the code already compares to false.To check if a variable equals false, use variable === false. Here, the if condition already compares to false, so just the variable name is needed.
Fix the error in the code to assign a boolean value correctly.
let isDone: boolean = [1];Boolean variables must be assigned true or false without quotes. Using strings or other types causes errors.
Fill both blanks to create a boolean expression that checks if x is true and y is false.
if (x [1] true && y [2] false) { console.log("Condition met"); }
== which can cause unexpected results.Use the strict equality operator === to compare boolean values for exact match.
Fill all three blanks to create a boolean expression that checks if a is true and c is true.
if ([1] [2] true && [3] === true) { console.log("All conditions met"); }
== instead of strict equality ===.Use the strict equality operator === to check if a and c are true.