Skip to content

Instantly share code, notes, and snippets.

@LRagji
Created February 21, 2019 11:24
Show Gist options
  • Save LRagji/e3944590e30ea6e85820184df635d05d to your computer and use it in GitHub Desktop.
Save LRagji/e3944590e30ea6e85820184df635d05d to your computer and use it in GitHub Desktop.
[JS]Pro-Tips:Always specify "radix" in parseInt
let i=parseInt(0700,10)//GOOD Implementation radix is passed.
let i=parseInt(0700)//BAD Implementation choosing the radix is now upto the runtime.
//Check this article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
//If the input string begins with "0", radix is eight (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet. For this reason always specify a radix when using parseInt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment