convert float value to number in javascript ES6

2 years ago23k times

simplest way to convert float value to number in Javascript ES6 with the following code


let str = "12345.00";
str = str.substring(0, str.length - 3);
console.log(str); // 12345
Other answers

Convert float value to number using floor function in javascript es6


var value = Math.floor(99.26);
console.log(value);

Convert float value to number using a Math.ceil function in javascript es6


var value = Math.ceil( 55.4556 );
console.log(value); //56

convert float value to number in javascript ES6 using parseInt


var flvalue = 55.678;
var intValue = parseInt(flvalue, 10);
console.log(intValue);// 55

Add Answer

Add a codeAdd Code
Remove adsremove

Latest codes

view all

Latest Snippets

view all