Chalkboard - v3.0.1
    Preparing search index...

    Function REGISTER

    • Registers a custom function to use with real/complex-valued parsing.

      Parameters

      • name: string

        The name of the function to register

      • func: (...x: number[]) => number

        The function

      Returns void

      // Register factorial function
      Chalkboard.REGISTER("factorial", (x) => {
      let n = 1;
      for (let i = 1; i <= x; i++) n *= i;
      return n;
      });

      // Returns 24
      const twentyfour = Chalkboard.real.parse("factorial(4)");