Front-end scrambled JavaScript learning Note four

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.