Skip to content

Arrow function #764

@plantaest

Description

@plantaest

Hi, I have a question, can JSONata have arrow function?

Getting code from this page: https://docs.jsonata.org/programming

$product := function($a, $b) { $a * $b };
$factorial := function($n) { $n = 0 ? 1 : $reduce([1..$n], $product) };

The code can be written as follows:

$product := ($a, $b) => $a * $b;
$factorial := $n => $n = 0 ? 1 : $reduce([1..$n], $product);

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions