JavaScript παράδειγμα

Αριθμοί στο JavaScript

Οι αριθμοί μπορούν να γραφτούν με ή χωρίς σημείο
Μπορείτε να γράψετε αριθμούς μεγάλης ή μικρής κλίμακας με μέθοδο εξponentιακής αριθμητικής
Οι αριθμοί θα ακριβούν μέχρι 15 ψηφία
Η αριθμητική ακρίβεια των πλούσιων αριθμών δεν είναι πάντα 100% ακριβής
Αλλά μπορεί να λυθεί με πολλαπλασιασμό και διαιρέσεις με 10
Ο συνδυασμός δύο αριθμών παράγει νέο αριθμό
Ο συνδυασμός δύο αριθμητικών strings παράγει συνδυασμένη αλφαριθμητική字符串
Ο συνδυασμός αριθμών και αριθμητικών字符串 παράγει επίσης συνδυασμένη αλφαριθμητική字符串
Ο συνδυασμός αριθμητικών字符串 και αριθμών παράγει επίσης συνδυασμένη αλφαριθμητική字符串
Συνδυασμός字符串 και αριθμών με συχνή λάθηση 1
Common error 2 when adding strings and numbers
In division operations, JavaScript will try to convert strings to numbers
In multiplication operations, JavaScript will try to convert strings to numbers
In subtraction operations, JavaScript will try to convert strings to numbers
In addition operations, JavaScript will not convert strings to numbers
The number divided by a string is no longer a number
Dividing a number by a numeric string results in a number
The global JavaScript function isNaN() determines whether a value is a number
Using NaN in mathematical operations will always return NaN
Using NaN in mathematical string operations will concatenate NaN
The type of NaN is number (no! typeof NaN returns number)
If a number outside the maximum possible number is calculated, it returns infinity (Infinity)
Division by zero generates Infinity
Infinity is also a number (typeof Infinity returns number)
Constants prefixed with 0x are interpreted as hexadecimal
The toString() method can output numbers in hexadecimal, octal, or binary
Numbers can be objects
Numbers and objects cannot be safely compared
Objects and objects cannot be safely compared

Example Explanation: Numbers