Periksa apakah nomor desimal atau integer JS
// check if number inserted in input is decimal or integer
// if integer, return the integer value,
// else set fixed limit for decimal value.
// e.g. 15.347394 => 15.347
function check(element) {
if (Number.isInteger(element)) {
return element;
}
return element.toFixed(3);
}
Whale