NickName:AMAR MAGAR Ask DateTime:2019-10-10T13:06:02 Number to Float Conversion in JavaScript I want Conversion from Number to Float in JavaScript function circumference(r) { return parseFloat(r); } console.log(circumference(4)); expected output: 4.00 Copyright Notice:Content Author:「AMAR MAGAR」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.Link to original article:https://stackoverflow.com/questions/58315757/number-to-float-conversion-in-javascript Answers kyun 2019-10-10T05:08:20 You can use toFixed()\n\nhttps://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed\n\n\r\n\r\nfunction financial(x) {\r\n return Number.parseFloat(x).toFixed(2);\r\n}\r\n\r\nconsole.log(financial(4));", Charlie 2019-10-10T05:09:29 Use Number.prototyp.toFixed() function. You can pass the number of decimal places as the argument.\n\n\r\n\r\nfunction circumference(r) {\r\n return r.toFixed(2);\r\n}\r\nconsole.log(circumference(4));", Rio A.P 2019-10-10T05:08:40 use parseFloat().toFixed() like this :\n\n\r\n\r\nvar number = parseFloat(4).toFixed(2);\r\nconsole.log(number);",