Numbers are everywhere

As we said earlier, numbers play an important role in today's complex programming and having a firm grip means that you can ensure that you have covered this role.

Let's try to list out some programs that use a lot of numbers.
  1. POS Apps: in calculating the total price, price after discount, the given amount of cash, the amount of cash to be returned etc.
  2. Online quizes: in calculating total marks, percentages, percentiles etc.
  3. Animations: in moving, or a better word - transforming, objects. This includes translation, rotation, skew and alot of stuff.
  4. And you can think of many more
Thus, this clarifies that being perfect with numbers is crucial for being perfect in advanced programming. And being perfect in Javascript numbers isn't difficult at all. Just a few things and you are covered. Then why not start with it!

Number and Math objects

To work around with numbers in JavaScript we have two simple friend objects of ours - Number and Math. The Number object provides with only a few methods specifically to help in rounding numbers whereas the Math object has got a whole bucket full of useful properties and methods to choose from.

Using the Math object we can calculate sin, cos, tan for angles in radians, convert these to degrees. We can calculate squares, square roots, absolute values and so much more that we can make our own functional calculator.

We will go over both these objects in a coming chapter - for now just remember their names so when we introduce them later you don't get surprised!