home gear home donate
Search Results For

Libraries book

HTML Library CSS Library JavaScript Library PHP Library


PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous


Website Hosting Developer Q+A
Sprite Programming Mastery
Number Object Javascript

The Javascript Number object sports a set of constants and methods for script authors when they work with numeric data.

Number Object Syntax

var num1 = 5;
var num2 = Number(5);
var num3 = new Number(5);

All three of the approaches above are acceptable syntax for establishing a number in Javascript.


Constants(Properties) of the Number Object

MAX_VALUE - represents the maximum value
MIN_VALUE - represents the minimum value
NaN - represents not a number value
NEGATIVE_INFINITY - represents negative infinite value
POSITIVE_INFINITY - represents positive infinite value

var v1 = Number.MAX_VALUE;
var v2 = Number.MIN_VALUE;
var v3 = Number.NaN;
var v4 = Number.NEGATIVE_INFINITY;
var v5 = Number.POSITIVE_INFINITY;

Properties of the number object are constants, which means they are values that do not change.


Methods of the Number Object

toExponential - returns exponential notation of a number
toFixed - returns fixed point notation of a number
toPrecision - returns fixed point notation to a specified precision
toString - return a string that represents the number(convert number to string object)
valueOf - return the primitive value of a number

var num = 50;

var exn = num.toExponential(2);
var fix = num.toFixed(3);
var pre = num.toPrecision(5);
var str = num.toString();
var val = num.valueOf();


Home   •   Terms of Use   •   T-Shirts   •   RSS   •   Testimonials   •   Subscribe   •   Classroom Chalkboard   •   Developer Q+A   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties is a growing educational system packed with video and written material that you can access 24/7 100% free. The focus here in 2014 is spread between five technologies: HTML, CSS, JavaScript, PHP and MySQL. Learn programming theory, database interaction, web design, animation, graphics editing, vector art, 3D modeling, and much more. The educational experience here is a hybrid one offering both high quality video tutorials and code libraries that grow more robust every day. The code libraries are being assembled so that developers can discover all of the building blocks of their favorite languages. The libraries coupled with high quality video tutorials will take you deep down the rabbit hole very quickly. You can also ask questions and get free advice at