Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

digit count in javascript

function digitCount(num) {
  if(num === 0 ) return 1
  return Math.floor(Math.log10(Math.abs(num))) + 1
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #digit #count #javascript
ADD COMMENT
Topic
Name
3+5 =