JavaScript Language Basics 3

Source: Internet
Author: User

JavaScript can handle some data types from the real world. For example: numbers and text.

At the same time, JavaScript also includes some

Data types that have an abstract nature. such as object data types.

JavaScript It is a weakly typed language. Very many cases. When we are working with the data. There is no need to declare the type of data. JavaScript can self -

The type of their own.

since JavaScript is a weakly typed language, do we not have to discuss data types? In fact, in some cases, errors can occur, or JavaScript's

Judgment is inconsistent with your assumptions. In these cases, we need to display the type of declarative data in JavaScript.

Next we discuss several commonly used data types for javascript: numeric type, String type, Boolean type

First, numeric type

1) Integers: For example 1, 2, 3,-1,-2, etc., integers can be positive and can be negative. The range is -2^53~~2^53.


2) Score: for example 2.3, 4.3, etc., ibid, can be positive can also be negative.


In the actual use. You don't have to care about the range of values in JavaScript, and JavaScript sees them as floating-point types.


ii. Text Data

In JavaScript. A string is a text enclosed in a "(citation)", for example, "Hello World", "123".


There are many special characters that are not directly entered in JavaScript, and we need to use escape characters to represent them.   We use   Represents a space character, the following is how some escape characters are used:

Escape Character Series escape character represents meaning

\b Backspace

\f Page Break

\ n line break

\ r return character

\ t tab (tab)

\ ' Single cited

\ "Double-cited

\ \ Backslash

\xnn the NN is a hexadecimal number. Represents the number of characters in the Latin-1 character set


Third, Boolean data

The value of the JavaScript Boolean type is: true means "yes". False indicates yes "no"






Reprint Please specify source: http://blog.csdn.net/hai_qing_xu_kong/article/details/40735895 Emotional Control _ Click to open link




JavaScript Language Basics 3

Related Article

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.