JavaScript Operator allows you to set the necessary program branches. JavaScript: IF and ELSE - Instructions for conditions. Logic Operations on Terms
Good day. In touch, Alexey Gulein. In the last article we disassembled creating cycles in javascript . In this article I would like to tell about conditional Operator in JavaScript. In general, all programming consists of conditions, and in all programming languages \u200b\u200b(JavaScript has not exceeded) there is a concept of a conditional operator. The meaning of the conditional operator It is that if the condition is performed, then these actions are made if it is not done - then do other actions. The general scheme of the conditional operator looks like this:
If (condition) (// block of operators); ELSE (// block of operators)
Let's immediately write any example: we will request a user's number and, if it is even, output "This is an even number", if not - "This is an odd":