JavaScript Basics -3 JavaScript data types, data type conversions

Source: Internet
Author: User

First, the data type


Data type

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/F5/wKiom1bznFWAdIFZAAFIoygnesg103.png "title=" Web.png "alt=" Wkiom1bznfwadifzaafioygnesg103.png "/>


Basic type

-Number Type

-can represent either a 32-bit integer or a 64-bit floating-point number

-Integer

-Decimal: A whole number of ten-in-one, such as 1234567890

-Eight binary: every eight into an integer, such as 01235670

-16 binary:

-Floating point number

-Use decimal point to record data, such as 95.5,3.1415926

-Use index to record data, such as 4.3e23, 4.3E-23


String type

-String type

-Represents a series of text character data, such as gender, name, address, etc.

-sequences consisting of Unicode characters, numbers, punctuation

-JavaScript does not strictly differentiate between character and string types as in the Java language

-a pair of single or double quotation marks

-special characters require escape character

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7D/F2/wKioL1bzn7uBPa64AAAeRsSO_CM811.png "title=" Web.png "alt=" Wkiol1bzn7ubpa64aaaersso_cm811.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/F2/wKioL1bzn_CwaZ9hAAAzm2J-ms8369.png "title=" Web.png "alt=" Wkiol1bzn_cwaz9haaazm2j-ms8369.png "/>


Boolean type

-Boolean type

-Only two values: True and False

-also represents 1 and 0

-True=1,false=0 in the actual operation


Undefined

-Undefined

-Semantics: The data does not exist

-A variable was declared but never assigned, or the object property does not exist

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7D/F2/wKioL1bzoIey7LovAAAwofK0rXI603.png "title=" Web.png "alt=" Wkiol1bzoiey7lovaaawofk0rxi603.png "/>



Ii. Conversion of data types


Implicit conversions

-JavaScript is loosely typed programming language

-the variable does not need to specify a data type when declaring

-variables are determined by the assignment operation data type

-Different types of data are automatically converted during the calculation

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/F2/wKioL1bzocTzh6H7AABG6hh1T8M734.png "title=" Web.png "alt=" Wkiol1bzoctzh6h7aabg6hh1t8m734.png "/>650" this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/ 7d/f6/wkiom1bzouyj5e5maaa2t_565fy008.png "title=" Web.png "alt=" Wkiom1bzouyj5e5maaa2t_565fy008.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/F6/wKiom1bzol7DQrY-AAGZmvQIxUc015.png "title=" Web.png "alt=" Wkiom1bzol7dqry-aagzmvqixuc015.png "/>

Data type Conversion Functions

-ToString ()

-Convert to string, all data types can be converted to string type

-parseint ()

-resolves an integer part of a string or number

-Returns Nan (not a number) if there is no part to convert

-Parsefloat ()

-Resolves a string's floating-point number part

-Returns Nan if there are no parts that can be converted

-Number ()

-Parse a string into number

-Returns Nan if illegal characters are included


Summary: This chapter covers JavaScript data types, data type conversions


This article from the "Technical Exchange" blog, declined reprint!

JavaScript Basics -3 JavaScript data types, data type conversions

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.