Snippets Collections
>>> int(3.7)
3

>>> int(-3.4)
-3

>>> int(round(3.8))
4
var x = 1.234;
 
var y = x.toExponential(2); 
// returns y = 1.23e+0
 
var y = x.toExponential(5);  
// returns y = 1.23450e+0
parseInt("10");         // returns 10
parseInt("10.33");      // returns 10
parseInt("10 20 30");   // returns 10
parseInt("10 years");   // returns 10
parseInt("years 10");   // returns NaN 
var x = 1.2345;

var y = x.toFixed(0);
//y equals 1;

var y = x.toFixed(2);
//y equals 1.23

var y = x.toFixed(5);
//y equals 1.23400
var x = 123;

//OPTION 1
var y = x.toString();           

//OPTION 2
var y = (123).toString();        

//OPTION 3
var y = (100 + 23).toString();   

// value of y is 123 in all 3 cases.
var x = 1234;
var y = x.valueOf(); 

var y = (1234).valueOf();

var y (1000+234).valueOf();

//y equals 1234 in all 3 cases
bookmark
dashboard

Thu Feb 06 2020 19:00:00 GMT+0000 (UTC)

#python #numbers
bookmark
dashboard

Sun Jan 12 2020 17:40:37 GMT+0000 (UTC) https://slate.com/technology/2019/10/consequential-computer-code-software-history.html

#historicalcode #numbers
bookmark
dashboard

Fri Jan 10 2020 19:00:00 GMT+0000 (UTC)

#javascript #jsfunctions #numbers
bookmark
dashboard

Wed Jan 08 2020 19:00:00 GMT+0000 (UTC)

#javascript #numbers #jsfunctions

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension