# Supported JavaScript Syntax

Below is a concise, product‑safe summary of the JavaScript syntax supported in the iX Hello Customer v2 Expression Engine.

#### Literals:&#x20;

**Literals** are the **fixed, constant values written directly in an expression**.\
They represent **actual data**, not variables or logic.

```
    42                             // Number    
    3.14                           // Float    
    'hello'                        // String (single quotes)    
    "hello"                        // String (double quotes)    
    `hello ${name}`                // Template literals    
    true / false                   // Boolean    
    null                           // Null    
    [1, 2, 3]                      // Array literal    
    { name: 'John', age: 30 }     // Object literal    
```

#### Operators:

Operators are symbols that tell the engine what operation to perform on values (literals or variables).

```
    // Arithmetic    
    a + b    a - b    a * b    a / b    a % b    a ** b    
         
    // Comparison    
    a === b    a !== b    a == b    a != b    
    a > b      a >= b     a < b    a <= b    
         
    // Logical    
    a && b    a || b    !a    a ?? b    
         
    // Ternary    
    condition ? valueIfTrue : valueIfFalse    
         
    // Member access    
    obj.property    obj['property']    arr[0]    arr[arr.length - 1]    
         
    // Safe navigation (built-in — no ?. syntax needed)    
    // Accessing a property on null/undefined returns undefined instead of throwing    
    obj.property    obj.nested.deep    arr[0]    
         
    // Spread    
    [...arr1, ...arr2]    { ...obj1, ...obj2 }    
         
    // typeof    
    typeof value === 'string'    
```

#### Arrow Functions (Concise Only)

Arrow functions are supported only in concise form and only when used as callbacks to array methods. This is an intentional design choice to keep expressions safe, readable, and side‑effect free.

```
// Supported: concise arrow (expression body)    
    items.filter((x) => x.active);    
    items.map((x) => x.name.toUpperCase());    
    items.reduce((sum, x) => sum + x.price, 0);    
    items.sort((a, b) => a.name.localeCompare(b.name));    
         
    // NOT supported: block-body arrow    
    items.filter((x) => {    
      return x.active;    
    }); // REJECTED    
    items.map((x) => {    
      const n = x.name;    
      return n;    
    }); // REJECTED    

```

Block-body arrow functions are explicitly not supported. The parser only accepts expression-body\
arrows. Since expressions are read-only (no variable declarations, no assignments), block bodies\
provide no additional capability over concise Form.

#### Not Supported

```
         
    // Assignments (expressions are read-only)    
    x = 5                          // REJECTED    
    x += 1                         // REJECTED    
    x++                            // REJECTED    
         
    // Statements    
    if (x) { ... }                // REJECTED — use ternary instead    
    for (...)                      // REJECTED — use array methods instead    
    while (...)                    // REJECTED    
    var / let / const              // REJECTED    
         
    // Block-body arrows    
    x => { return x.active }      // REJECTED — use x => x.active    
         
    // Dangerous globals    
    eval('...')                    // REJECTED    
    new Function('...')            // REJECTED    
    require('...')                 // REJECTED    
         
    // Optional chaining syntax    
    obj?.property                  // REJECTED — not needed (see below)    
    arr?.[0]                       // REJECTED    
    obj?.method()                  // REJECTED    
         
    // Prototype access    
    obj.__proto__                  // REJECTED    
    obj.constructor                // REJECTED    
    obj.prototype                  // REJECTED  

```

Safe Navigation (Built-in) : In standard JavaScript, trying to read a property from a null or missing value will crash your code with a TypeError. This engine handles that automatically — if any value in a chain like 'obj.nested.deep' turns out to be null or undefined, it simply returns 'undefined' instead of throwing an error. This protection applies to all property lookups by default, so there's no need to use the '?.' operator syntax here.

&#x20;"If you need examples to know how these expressions are applied, please use our new and improved iX Hello Employee"


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc2/technical-specifications/expression-engine/supported-javascript-syntax.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
