JavaScript Math object contains some useful and powerful mathematical operations that can be used in web development. But it lacks many important operations that most other languages provide (such as Haskell, which has a huge number of them) Here are quick links to each one: Sum - Product - Odd and Even - triangleNumber - Factorial - Factors. For a number to be even, it must be divisible by two, it’s the opposite.

11m read timeFrom sitepoint.com
Post cover image
Table of contents
Missing Math Methods in JavaScript: SumMissing Math Methods in JavaScript: ProductMissing Math Methods in JavaScript: Odd and EvenMissing Math Methods in JavaScript: triangleNumberMissing Math Methods in JavaScript: FactorialMissing Math Methods in JavaScript: FactorsMissing Math Methods in JavaScript: isPrimeMissing Math Methods in JavaScript: gcd (Greatest Common Divisor)Missing Math Methods in JavaScript: lcm (Lowest Common Multiple)Conclusion

Sort: