Here's a function that calculates the nth nonagonal number in javascript:
index.tsx158 chars7 lines
The formula for the nth nonagonal number is n(5n - 3) / 2. We simply plug in the value of n in the formula and return the result.
gistlibby LogSnag