When working with scripts within Infoplus you may encounter an instance when you need to use an operator. This article will list the most commonly used JavaScript operators available to Infoplus.
xDue to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.
Logical Operators
Operator | Description | Example |
---|
&& | and | (x < 10 && y > 1) is true |
|| | or | (x === 5 || y === 5) is false |
! | not | !(x === y) is true |
Arithmetic Operators
Operator | Description | Example | Result in y | Result in x |
---|
+ | Addition | x = y + 2 | y = 5 | x = 7 |
- | Subtraction | x = y - 2 | y = 5 | x = 3 |
* | Multiplication | x = y * 2 | y = 5 | x = 10 |
/ | Division | x = y / 2 | y = 5 | x = 2.5 |
% | Modulus (division remainder) | x = y % 2 | y = 5 | x = 1 |
++ | Increment | x = ++y | y = 6 | x = 6 |
x = y++ | y = 6 | x = 5 |
-- | Decrement | x = --y | y = 4 | x = 4 |
x = y-- | y = 4 | x = 5 |
Assignment Operators
Operator | Example | Same As | Result in x |
---|
= | x = y | x = y | x = 5 |
+= | x += y | x = x + y | x = 15 |
-= | x -= y | x = x - y | x = 5 |
*= | x *= y | x = x * y | x = 50 |
/= | x /= y | x = x / y | x = 2 |
%= | x %= y | x = x % y | x = 0 |
String Operators
Operator | Example | text1 | text2 | text3 |
---|
+ | text3 = text1 + text2 | "Good " | "Morning" | "Good Morning" |
+= | text1 += text2 | "Good Morning" | "Morning" | "" |
Comparison Operators
Operator | Description | Comparing | Returns |
---|
== | equal to | x == 8 | false |
x == 5 | true |
=== | equal value and equal type | x === "5" | false |
x === 5 | true |
!= | not equal | x != 8 | true |
!== | not equal value or not equal type | x !== "5" | true |
x !== 5 | false |
> | greater than | x > 8 | false |
< | less than | x < 8 | true |
>= | greater than or equal to | x >= 8 | false |
<= | less than or equal to | x <= 8 | true |