parseFloat("2,83") will return 2 because , is not recognized as decimal separator, while . is.

If you want to round the number to 2 decimal places just use parseFloat(discval.toFixed(2)) or Math.round(discval * 100) / 100;

If you need this jut for display purposes, then leave it as a string with a comma. You can also use Number.toLocaleString() to format numbers for display purposes. But you won't be able to use it in further calculations.

BTW .toFixed() returns a string, so no need to use .toString() after that.

Answer from pawel on Stack Overflow
🌐
SitePoint
sitepoint.com › javascript
Format of float numbers - JavaScript - SitePoint Forums | Web Development & Design Community
November 4, 2011 - I sum up some values with jQuery, which automatically inserts a dot if the result is a float. However, I would like to use a comma instead, how can I do this?
Discussions

Javascript Formatting numbers with commas
Carlo Sabogal is having issues with: My level of js is very basic. Currently I am learning about basic number operations. My question is: How do you display numbers on the screen wi... More on teamtreehouse.com
🌐 teamtreehouse.com
5
May 15, 2015
parsefloat - Javascript parse float is ignoring the decimals after my comma - Stack Overflow
If your locale uses periods for ... it to a float. If your locale uses commas instead of periods for decimal points, you can safely remove any periods (thousands separators) and then change the comma (decimal point) to a period. 2017-05-03T10:18:13.453Z+00:00 ... Why not use globalize? This is only one of the issues that you can run in to when you don't use the english language: ... parseFloat parses according to the JavaScript definition ... More on stackoverflow.com
🌐 stackoverflow.com
jquery - Convert String with Dot or Comma as decimal separator to number in JavaScript - Stack Overflow
An input element contains numbers a where comma or dot is used as decimal separator and space may be used to group thousands like this: '1,2' '110 000,23' '100 1.23' How would one convert the... More on stackoverflow.com
🌐 stackoverflow.com
How to replace a comma for a dot and a dot for a comma - Post.Byes
This is a thread in the JavaScript forum and you've given code for C - two very different programming realms. Anyway, thanks for your input. ... Thanks for this great discussion. it really helps me to sort out my problem too. As i also need to show comma instead of dot as dot does not recognise ... More on post.bytes.com
🌐 post.bytes.com
🌐
Queness
queness.com › post › 9806 › 5-missing-javascript-number-format-functions
5 Missing Javascript Number Format Functions
This Javascript function is designed to perform the same functionality of php number_format function. This function able to round and put comma on a give float number.
🌐
Bytes
bytes.com › home › forum › topic › javascript
How to replace a comma for a dot and a dot for a comma - Post.Byes
March 24, 2007 - "var tvn = parseFloat(docu ment.getElement ById('ctl00_Con tentPlaceHolder 1_txtMillilTVNH raefni').value. replace(/,/g, '.')*14);" and multiply with 14, that works fine, but i can't replace a dot for a comma before I display the sum. In me country we use comma instead of a dot for separating decimal numbers For example: a user has to be able to import 1,25 in a text box on my web site which changes to 1.25 before it's multiplied with 14 to get the sum of 17.5.
🌐
W3Resource
w3resource.com › javascript-exercises › fundamental › javascript-fundamental-exercise-125.php
JavaScript fundamental (ES6 Syntax): Convert a float-point arithmetic to the Decimal mark form and It will make a comma separated string from a number - w3resource
Write a JavaScript function that formats a decimal number into a localized string with appropriate commas. Write a JavaScript program that takes a float and returns its string representation in decimal format with grouping commas.
Find elsewhere
🌐
CodePen
codepen.io › Kosai106 › pen › XdjoGp
Replace comma with dot in input
.wrapper %p Javascript is used to replace commas with dots. %input{placeholder: "Type a comma...
🌐
EyeHunts
tutorial.eyehunts.com › home › javascript parsefloat comma | example code
JavaScript parseFloat comma | Example code
December 9, 2022 - Do a replace first to convert String with Dot or Comma as a decimal separator to number using parseFloat method in JavaScript.
🌐
Stack Overflow
stackoverflow.com › questions › 61770052 › float-input-want-to-show-comma-not-dot
javascript - Float input, want to show comma, not dot - Stack Overflow
May 13, 2020 - Does anybody know if it is possible for the second inputfield to show the comma? ... const floatParser = parserFunc => (value) => { const nr = parseFloat(parserFunc(value)); if (Number.isNaN(nr)) return undefined; return nr; }; export const parsePercentage = floatParser(stripPercentageMaskedValue); export const percentageMask = createNumberMask({ allowNegative: true, allowDecimal: true, decimalSymbol: ',', prefix: '', suffix: PERCENTAGE_SUFFIX, });
🌐
OpenText
community.opentext.com › it_ops_mgt › sbm › f › discussions › 527288 › how-to-replace-dot-by-comma-in-javascript
How to replace dot by comma in javascript ? - SBM User ...
April 15, 2024 - Unstructured Data Analytics · If an answer to your question is correct, click on "Verify Answer" under the "More" button. The answer will now appear with a checkmark. Please be sure to always mark answers that resolve your issue as verified. Your fellow Community members will appreciate it!
🌐
ASPSnippets
aspsnippets.com › questions › 178768 › Replace-comma-with-period-dot-and-allow-decimal-value-in-TextBox-in-JavaScript
Replace comma with period dot and allow decimal value in TextBox in JavaScript
November 2, 2020 - Forum: JavaScript · Answer: 1 · Views: 8693 · Sample Code: Download · I want allow comma (,) then replace to dot (.) Like 45, then results is 45. Comma don't must starting first. Here is code: <input id="number" value="" placeholder="" autofocus> var input = document.getElementById('number'); input.onkeyup = input.onchange = enforceFloat; //enforce that only a float can be inputed function enforceFloat() { var valid = /^\-?\d+\.\d*$|^\-?[\d]*$/; var number = /\-\d+\.\d*|\-[\d]*|[\d]+\.[\d]*|[\d]+/; if (!valid.test(this.value)) { var n = this.value.match(number); this.value = n ?
🌐
Medium
medium.com › @noffybarudwale › javascript-format-numbers-with-commas-and-decimals-86b68ec5b180
JavaScript : Format numbers with commas and decimals. | by Nofij Barudwale | Medium
October 13, 2021 - Sometimes, you may need to format a number value with commas and decimals in your HTML pages to make it easier to read. Here I found both in one. You can transform a number value into a comma-separated with decimals by using JavaScript. Here are several ways to do that. There are many different ways of printing an integer with a comma as a thousands separators in JavaScript.
🌐
Copahost
copahost.com › home › javascript parsefloat: examples and variations of this function
Javascript parseFloat: Examples and variations of this function - Copahost
July 16, 2023 - In the above code, for example, we passed a string with a comma in the parseFloat method. The output is only the number before a comma. In JavaScript, the parseFloat() function is basically used to convert a string to a floating-point number.