FunctioncomputeNpv

  • Computes and returns the Net Present Value (NPV) of the given cash flows and discount rate.

    Parameters

    • cashFlows: number[]

      The cash flow of each period.

    • rate: number

      The discount rate.

    Returns number

    The NPV. NaN if no solution.