1 JavaScript Number object:
JavaScript has only one numeric object, which is number. In JavaScript, all numbers are 64 bits, which is different from other programming languages (type languages), that is, JavaScript is not a type language, no shaping, floating-point, and so on.
Integers with up to 15 bits (no decimal or exponential notation)
Decimals have a maximum of 17 digits.
In JavaScript, if the first number of a number is 0, it is interpreted as octal, and if the first digit of the number is 0x, it is interpreted as 16 binary.
Property:
- Max value: Max
- Min Value: Minimum
- Negative infinitive: Negative infinity, returns this value when overflow
- POSITIVE Infinitive: Positive infinity, returns this value when overflow
- NaN: Non-numeric value
- Prototype: Allow adding properties and methods to objects
- Constructor: Returns a reference to the number function that created this object.
Method:
- Toexponential (): Converting numbers to exponential techniques
- ToFixed (): Converts a number to a string, followed by a number with the specified number of digits after the decimal point.
- Toprecision (): Bar number formatted as specified length
- ToString (): Converts a value to a string type, using the specified cardinality
- ValueOf (): Returns the base numeric value of an object
2 JavaScript String object:
To calculate the length of a string: Use Length Property
Add a style to a string: such as Big,small,bold,italics.
IndexOf (): To position the first occurrence of a specified character in a character.
Match (): To find a specified character in a string and return the character if found. Otherwise, NULL is returned
Replace (/.. /,".." ): Replaces the characters specified in the string with the specified character
3 JavaScript Date object:
Date (): Returns the current date and time
GetTime (): Returns the number of milliseconds elapsed from January 1, 1971 to today
setFullYear (): Set the specific date (where the month parameter is 0--11)
toUTCString (): Converts date of day to string
GetDay (): Use this function and array to show the day of the week
|
Converts a number to a string, the result of which has a specified number of digits after the decimal point. |
Front-end scrambled JavaScript learning Note four