<Script type = "text / JavaScript"> var X = 4.23323; // testing digital var Y = String (X) .indexOf ( ".") +. 1; // Get the decimal point var COUNT = String (X) .length - Y; // number after the decimal point obtaining IF (Y> 0 ) { Alert ( "decimal figure is, there is" + count + "decimal" ); } the else { Alert ( "not a decimal" ); } </ Script>
// Reserved n decimal function roundFun (value, n) { return Math.round (Math.pow * value (10, n)) / Math.pow (10, n); }