Accessing data
var
Retrieves a value from the data object. This is the most fundamental operator for accessing product attributes.Logic and boolean operations
if
Conditional logic with if-then-else structure.and
Logical AND operation. Returns true if all conditions are true.or
Logical OR operation. Returns true if any condition is true.! (not)
Logical NOT operation. Negates a boolean value.!! (double not)
Converts a value to boolean. Returns true if the value exists and is truthy.Comparison operations
== (equals)
Loose equality comparison.=== (strict equals)
Strict equality comparison (type and value must match).!= (not equals)
Loose inequality comparison.!== (strict not equals)
Strict inequality comparison.> (greater than)
>= (greater than or equal)
< (less than)
<= (less than or equal)
Arithmetic operations
+ (addition)
- (subtraction)
* (multiplication)
/ (division)
% (modulo)
Array operations
map
Transforms each element in an array.filter
Filters an array based on a condition.reduce
Reduces an array to a single value using an accumulator.accumulator- The accumulated valuecurrent- The current array element- The third argument is the initial value for the accumulator
all
Returns true if all elements in an array match the condition.some
Returns true if any element in an array matches the condition.none
Returns true if no elements in an array match the condition.in
Checks if a value is in an array or if a substring exists in a string. Case Sensitivity Behavior:- String-in-array matching: Case-insensitive. When checking if a string exists in an array of strings, the comparison ignores case differences.
- Substring-in-string matching: Case-sensitive. When checking if a substring exists within a string, the comparison is case-sensitive.
- Non-string values: Exact matching. Numbers, booleans, and other non-string types use strict equality comparison.
true because “blue” matches “Blue” (case-insensitive).
true if the tags array contains “premium”, “Premium”, “PREMIUM”, or any case variation.
Case-sensitive substring matching:
true only if “cotton” (lowercase) appears in the description. “Cotton” or “COTTON” would not match.
Exact matching for non-string values:
true because the number 123 matches exactly.
false because the string “123” does not match the number 123 (different types).