JS Data Types - number vs BigInt questions

Posted by bocamj@reddit | learnprogramming | View on Reddit | 4 comments

Hi there, I'm learning data types in javascript. Messing around. I used these variables.

let x = 15;
let y = 123456789999;

typeof shows them both as numbers. So it got me thinking...

  1. Where does number end and bigint begin? I went as high as let y = 1234567899999999999999999999999999999; and it was still a number. When I put an n on the end, it's bigint, so
  2. What does n stand for or translate to? Is it infinity, or does it make it some continuous number? I thought number and bigint were separate DTs for memory purposes, so
  3. Is there an explicit way to declare a number vs bigint? I want to see what happens if I declare a bigint as a number and vice versa. But number is reserved, so I can't "let number = 123456789999n".
  4. Lastly, does anyone use bigint in programming, I mean, does it serve a practical purpose?

Thanks