@iggijimenez/math-lib
v1.0.1
Published
Challenge 1 GoldenRatio - Add a new property to Number that is the Golden Ratio
Downloads
4
Readme
Math Library
JavaScript Libraries
Installation
GoldenRatio()
Add a new property to Number that is the Golden Ratio
capitalize("macbook");
// returns "Macbook"
Number Methods
round()
rounds to the nearest whole number
9.50.round();
// returns 10
floor()
goes to the nearest lowest whole number
9.50.floor()
// returns 9
ceil()
returns the highest nearest whole number
9.4.ceil()
// returns 10
pad()
returns pads Number with x 0s before, and y 0s after
1.1.pad(4, 4);
// returns 0001.1000
degToRad()
returns a convertion from degrees to radians
degToRad(45);
// returns 0.785
radToDeg()
Coverts radians to degrees.
readToDeg(0.785);
// returns 44.977
toDollars()
returns input formatting money is a common task for software projects. A function could save you time in the future. The goal of this function is to take a numeric value and return a string beginning with a '$' and rounded to two decimal places
toDollars(10);
// returns $10.00
tax(rate)
Returns the tax amount
tax(10);
// returns 10.10
interest(total, year, rate)
returns the calculation with the interest over time
interest(10, 10, 8)
// returns 21.58
mortage(principal, numberOfPayments, interestRate))
returns the calculation of a mortage
mortage(10, 10, 8)
// returns 100.00000046650739