Mathematical tricks of Javascript

factorial formula

Factorial (n!):

The factorial of n is denoted by n! and calculated by the product of integer numbers from 1 to n.

Factorial definition formula

Recursive factorial formula

n! = n×(n-1)!

Now we solve the Recursive way

Fibonacci Series:

The Fibonacci numbers are generated by setting F0 = 0, F1 = 1, and then using the recursive formula
Fn = Fn-1 + Fn-2
to get the rest. Thus the sequence begins: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … This sequence of Fibonacci numbers arises all over mathematics and also in nature.

Prime Number:

A prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.

Truthy Vs Falsy:

  • 0 (zero)
  • '' or "" (empty string)
  • null
  • undefined
  • NaN
  • 'false' (a string containing the text “false”)
  • [] (an empty array)
  • {} (an empty object)
  • function(){} (an “empty” function)

Throughout my career as a front end developer I've emphasized the importance of scalable and well documented.