There can be more else if blocks. We're going to talk through how Boolean values work, and … It can be initialized using new keyword. Write some code that will alert “2 is less than 1” if 2 is less than 1 and will alert “2 is not less than 1” otherwise…. A non-numeric string converts to NaN which is always false. Try it out yourself… It will no longer alert “Yay!”. TutorialsTeacher.com is optimized for learning web technologies step by step. To use it effectively, we’ve to know about the basics of it. P.S. JavaScript treats an empty string (""), 0, undefined and null as false. I’m still really enjoying blogging, creating content and sharing my knowledge with Y’all, and love the chats that I have with subscribers and other members of the community. Here’s what an if statement looks like with both an else if and an else: This may look confusing at first. isAdmin);} The ! But we can compare in other ways as well! In essence, an if statement simply executes some code if a value is equivalent to true. This comparison sign says is saying “if they are equal, then return true”. Question 3: Alert “I am such a rebel” if 5 plus 5 is not equal to 10 or 2 plus 4 is greater than or equal to 7. Here is a list of the properties of Boolean object − Home; Blog; About; Contact; Now; Data Types in JavaScript : Boolean. Therefore, if we put this inside the brackets our code will run! A … In classical programming, the logical OR is meant to manipulate boolean values only. Don’t ask me why, programming languages sometimes have weird things like that. I’m perfectly happy giving my content away free - otherwise, you would be paying to read this right now! Put the following code in your