jquery - Why does the javascript interpreter get -8 as the result for the statement parseInt(1/8-9,23)? -


i'm not sure why happening.

parseint(1/8-9,23); > -8 

any how works good.

that's expected answer. https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/parseint:

if parseint encounters character not numeral in specified radix, ignores , succeeding characters , returns integer value parsed point. parseint truncates numbers integer values

so, -8.875 parsed, . not valid integer truncated -8. since 8 < 23, -8 in base 23 -8


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -