If you use new Number() you are creating a JavaScript Number object. In addition to all of the various operations you can perform on numbers such as addition, subtraction, multiplication, division etc. there are also a range of methods that Number objects have available.
Just assigning a number to a variable does not create a Number object and so avoids the overhead of all the additional processing that JavaScript itself requires in order to process objects rather than primitive fields such as numbers. We still have no reason for needing to define Number objects specifically though just in order to use the Number methods because as soon as you apply a Number method to a number that has just been defined as a number rather than a Number object, JavaScript will convert that number to an object and make all of the Number methods available to use with it. This means that we only need the overheads of Number objects when we actually use the methods that those objects supply.
In this example we show the two different ways of creating a number (one as an object and one as an ordinary number field) and we then use the toFixed method to do a comparison of the two numbers to two decimal places. That these two numbers are identically equal to two decimal places demonstrates that if you use Number methods that it doesn't matter which way you create the numbers. If you were to modify this code to assign the exact same value to both fields and then compare the fields directly rather than using the toFixed method then the two would not be equal because one is a Number object and the other is just a number.
var count1, count2, txt;
count1 = new Number(6.257);
count2 = 6.258;
if (count1.toFixed(2) === count2.toFixed(2))
txt = 'These values are equal to two decimal places.';
