Javascript&jquery.2javascript data

Source: Internet
Author: User

Data

Data type is very important, it is the premise of computer operation Security.

Common data types in JavaScript are: numbers, strings, Boolean values (Ture or FALSE)

All data types are: String, number, Boolean, null, undefined, symbol.

Use variables to store numbers

When the carpenter is making the table, he needs to calculate the length, width and height of the table, and when the computer calculates the area of the table, it also needs to record the length and width of the table, which are numbers.

< body > < script >      // 声明一个变量,用于临时存储桌子的长度      var length;      length=80;      var width=60;      document.writeln(‘桌子宽‘+width + ‘< br >‘);      document.writeln(‘桌子长‘ +length+ ‘< br >‘);      document.writeln(‘桌子的面积是‘ + width*length); </ script > </ body >use variables to store strings

Strings are most frequently used in computers, and strings are used to remember names, text, and so on.

characters in JavaScript are enclosed in a pair of double quotation marks ("") or a pair of single quotation marks (") .use quotation marks in a string

Many times, you need to use single or double quotation marks in a string.

How to use it?

If you want to use double quotation marks in a string, you must use single quotation marks to enclose the entire string .

If you want to use single quotation marks in a string, you must use double quotation marks to enclose the entire string .

Use variables to store Boolean values

A condition that a Boolean value is commonly used in a computer to make judgments.

arb = true;

if (b) {      document.write( "" ); } else {      document.write( "" ); }Test Questions

1. What are the common data types in JavaScript?

A: number, string, boolean value (Ture or False)

2. How do I use double quotes in a string?

A: If you want to use double quotation marks in a string, you must use single quotation marks to enclose the entire string .

Javascript&jquery.2javascript data

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.