Course Content
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
Boolean 4/4
Simple Applications of Boolean()
Function
We can pass expressions to the Boolean function to check whether it’s true
or false
. For example, the following code checks if the number passed to the Boolean()
function is completely divisible by 3. It returns true
if the value is completely divisible by 3 and false
otherwise.
console.log(Boolean(21%3 == 0));
But without Boolean()
we also get the same result. But Boolean function gives more clarity that Boolean value must return.
console.log(21%3 == 0);
Summary
- Boolean values are either
true
orfalse
. - The first letter of Boolean values (true and false) should be written in uppercase.
- The
Boolean()
method is used to evaluate an expression and returns true or false based on results.
Thanks for your feedback!
Boolean 4/4
Simple Applications of Boolean()
Function
We can pass expressions to the Boolean function to check whether it’s true
or false
. For example, the following code checks if the number passed to the Boolean()
function is completely divisible by 3. It returns true
if the value is completely divisible by 3 and false
otherwise.
console.log(Boolean(21%3 == 0));
But without Boolean()
we also get the same result. But Boolean function gives more clarity that Boolean value must return.
console.log(21%3 == 0);
Summary
- Boolean values are either
true
orfalse
. - The first letter of Boolean values (true and false) should be written in uppercase.
- The
Boolean()
method is used to evaluate an expression and returns true or false based on results.
Thanks for your feedback!
Boolean 4/4
Simple Applications of Boolean()
Function
We can pass expressions to the Boolean function to check whether it’s true
or false
. For example, the following code checks if the number passed to the Boolean()
function is completely divisible by 3. It returns true
if the value is completely divisible by 3 and false
otherwise.
console.log(Boolean(21%3 == 0));
But without Boolean()
we also get the same result. But Boolean function gives more clarity that Boolean value must return.
console.log(21%3 == 0);
Summary
- Boolean values are either
true
orfalse
. - The first letter of Boolean values (true and false) should be written in uppercase.
- The
Boolean()
method is used to evaluate an expression and returns true or false based on results.
Thanks for your feedback!
Simple Applications of Boolean()
Function
We can pass expressions to the Boolean function to check whether it’s true
or false
. For example, the following code checks if the number passed to the Boolean()
function is completely divisible by 3. It returns true
if the value is completely divisible by 3 and false
otherwise.
console.log(Boolean(21%3 == 0));
But without Boolean()
we also get the same result. But Boolean function gives more clarity that Boolean value must return.
console.log(21%3 == 0);
Summary
- Boolean values are either
true
orfalse
. - The first letter of Boolean values (true and false) should be written in uppercase.
- The
Boolean()
method is used to evaluate an expression and returns true or false based on results.