Skip to main content
Fix broken link
Source Link
Zsolt Meszaros
  • 23.3k
  • 19
  • 60
  • 70

The result of 1/0 is InfinityInfinity.

parseIntparseInt treats its first argument as a string which means first of all Infinity.toString() is called, producing the string "Infinity". So it works the same as if you asked it to convert "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

What happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I (because n is not a valid digit in base 19).

Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18 by the table above.

The result of 1/0 is Infinity.

parseInt treats its first argument as a string which means first of all Infinity.toString() is called, producing the string "Infinity". So it works the same as if you asked it to convert "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

What happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I (because n is not a valid digit in base 19).

Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18 by the table above.

The result of 1/0 is Infinity.

parseInt treats its first argument as a string which means first of all Infinity.toString() is called, producing the string "Infinity". So it works the same as if you asked it to convert "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

What happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I (because n is not a valid digit in base 19).

Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18 by the table above.

added 32 characters in body
Source Link
James Donnelly
  • 129.2k
  • 35
  • 215
  • 224
Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 
Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 
Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 
Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 
added 184 characters in body; added 91 characters in body; deleted 1 characters in body; added 9 characters in body
Source Link
Jon
  • 439.3k
  • 85
  • 756
  • 820

The result of 1/0 is InfinityInfinity. parseInt

parseInt treats its first argument as a string which means first of all Infinity.toString() is called, soproducing the string "Infinity". So it behavesworks the same as if you asked it to convert the input "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

So whatWhat happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I because (because n is not a valid digit in base 19).

Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18 by the table above.

The result of 1/0 is Infinity. parseInt treats its first argument as a string, so it behaves as if you asked it to convert the input "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

So what happens is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I because n is not a valid digit in base 19.

Therefore it behaves as if you called parseInt("I", 19) which converts to decimal 18 by the table above.

The result of 1/0 is Infinity.

parseInt treats its first argument as a string which means first of all Infinity.toString() is called, producing the string "Infinity". So it works the same as if you asked it to convert "Infinity" in base 19 to decimal.

Here are the digits in base 19 along with their decimal values:

Base 19 Base 10 (decimal) --------------------------- 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a 10 b 11 c 12 d 13 e 14 f 15 g 16 h 17 i 18 

What happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I (because n is not a valid digit in base 19).

Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18 by the table above.

added 421 characters in body
Source Link
Jon
  • 439.3k
  • 85
  • 756
  • 820
Loading
added 45 characters in body
Source Link
Jon
  • 439.3k
  • 85
  • 756
  • 820
Loading
Source Link
Jon
  • 439.3k
  • 85
  • 756
  • 820
Loading