Why is 76561198272848927 === 76561198272848930 true? [duplicate] - javascript

This question already has answers here:
Why are two different numbers equal in JavaScript?
(4 answers)
What is JavaScript's highest integer value that a number can go to without losing precision?
(21 answers)
Closed 2 years ago.
I currently try my best with the SteamAPI, for that I need the Profile-IDs. I tried out with my own, but somehow js changes the id.
EG:
https://imgur.com/a/83Yu6Cd
https://imgur.com/a/CRHtxnj
My ID is 76561198272848927, but JS somehow always change the last two digits from 27 to 30. Why? And how do I fix this?

Related

How to show below javaScript code without brackets? [duplicate]

This question already has answers here:
Easy way to turn JavaScript array into comma-separated list?
(22 answers)
Closed 2 years ago.
Code:
let myClassFellows=[ ['Noor',1],['Jawaria',2]];
console.log(myClassFellows[0]);
Below is the output I want to show without the square brackets
What do you mean without square brackets? Like 'Noor', 1?
If so, you need to concatenate it into a string with myClassFellows[0].join(', ').

Why is 429221958243152700-429221958243152682 on Google search output 0? [duplicate]

This question already has answers here:
max integer value in JavaScript
(3 answers)
max value of integer
(11 answers)
Closed 2 years ago.
Why is 429221958243152700-429221958243152682 on Google search output 0?
Does anyone know?
Also, when I did a form post with javascript for the value "429221958243152682", I get 429221958243152700.
What is wrong with the math?

assign value and display values are not same in javascript [duplicate]

This question already has answers here:
Number with leading zero in JavaScript
(3 answers)
Closed 2 years ago.
Have some doubts about the javascript. when I try to console
a = 021
console.log(a) // 17
why it is changing and how to store the exact value in the variable
Because with leading zero it's a octal-number so 21 is 2*8+1 = 16.
But when you print it out it's in decimal.

ValidationExpression for a number that doesn't consisting of just zeros [duplicate]

This question already has answers here:
Need a regular expression - disallow all zeros
(7 answers)
Closed 5 years ago.
I have asp:RegularExpressionValidator and the ValidationExpression is "\d{0,9}"
My problem is that I can't get a number consisting of just zeros.
How can I check this kind of thing?
Thanks for the help
Maybe this is what you're looking for:
/^[0]{0,9}$/

Summing numbers in javascript gives unexpected value [duplicate]

This question already has answers here:
Is floating point math broken?
(31 answers)
Whats the difference between JS Number.MAX_SAFE_INTEGER and MAX_VALUE?
(6 answers)
JavaScript summing large integers
(10 answers)
What is JavaScript's highest integer value that a number can go to without losing precision?
(21 answers)
Closed 5 years ago.
Strangely enough, when I try to add "9333852702227980 + 7", it returns me "9333852702227988" and not "9333852702227987".
I cannot figure out why! Any ideas and how to go around this problem?
alert((9333852702227980 + 7).toString());

Categories