Skip to content

Arrow function #764

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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