Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

float to string javascript

function toNumberString(num) { 
  if (Number.isInteger(num)) { 
    return num + ".0"
  } else {
    return num.toString(); 
  }
}

Input  Output
3      "3.0"
3.4567 "3.4567"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #float #string #javascript
ADD COMMENT
Topic
Name
2+2 =