Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript number and math

var pi = 3.141;
pi.toFixed(0);          // returns 3
pi.toFixed(2);          // returns 3.14 - for working with money
pi.toPrecision(2)       // returns 3.1
pi.valueOf();           // returns number
Number(true);           // converts to number
Number(new Date())      // number of milliseconds since 1970
parseInt("3 months");   // returns the first number: 3
parseFloat("3.5 days"); // returns 3.5
Number.MAX_VALUE        // largest possible JS number
Number.MIN_VALUE        // smallest possible JS number
Number.NEGATIVE_INFINITY// -Infinity
Number.POSITIVE_INFINITY// Infinity
Comment

PREVIOUS NEXT
Code Example
Javascript :: data attribute hide & show function syntax in jquery 
Javascript :: pdf js 
Javascript :: js for await 
Javascript :: how to add icon in javascript 
Javascript :: FTP download local file 
Javascript :: Example React Hook 
Javascript :: what is const in javascript 
Javascript :: nested function 
Javascript :: Nuxt.js + Electron 
Javascript :: target data option select vue js 
Javascript :: react responsive nav bar 
Javascript :: text slider in react js 
Javascript :: is date 1 day ago javascript 
Javascript :: what is event loop in javascript 
Javascript :: check if jwt token is valid 
Javascript :: javascript image preview before upload 
Javascript :: how to sort an array in js 
Javascript :: class 
Javascript :: how to dockerize a node app 
Javascript :: web storage api 
Javascript :: Do not use forEach with async-await 
Javascript :: javascript eval alternative 
Javascript :: req is not defined 
Javascript :: / w/g in javascript 
Javascript :: component will mount hooks 
Javascript :: word table to json 
Javascript :: if array includes string 
Javascript :: liquid filter 
Javascript :: ternary javascript 
Javascript :: js object destructuring 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =