Booleans are used for stating true or false which I will demonstrate with an example:
let isLoggedin =true;
let gameover=false;
Const iswaterwet=true;
Variables can change types which I will show with an example:
let numpuppies=23; //number
numpuppies=false; //now a Boolean
numpupies=100; // back to number
To note: doesn’t make sense to change from number to Boolean but it’s possible to do so.
In other programming language, its common when making a variable if a number that your storing ,that variable can only store number or variable can store boolean value.
Comments