JavaScript language includes operators that compare two operands and return Boolean value true or false :
### - Logical Operators
Logical operators are used to combine two or more conditions. JavaScript includes following logical operators:
JavaScript includes assignment operators to assign values to variables with less key strokes.
JavaScript includes special operator called ternary operator :? that assigns a value to a variable based on some condition. This is like short form of if-else condition.
** JavaScript functions ** are used to perform operations. We can call JavaScript function many times to reuse the code.
** There ** are mainly two advantages of JavaScript functions :
** Code reusability: ** We can call a function several times so it save coding.
** Less coding: ** It makes our program compact. We don’t need to write many lines of code each time to perform a common task.
For example , the following code defines a simple function named square:
** function square(number) { return number * number; } **
## and here we go :