[JavaScript tutorial] JavaScript Data Type

Source: Internet
Author: User
String, Number, Boolean, Array, Object, Null, Undefined ).

JavaScript Data Type

String, Number, Boolean, Array, Object, Null, Undefined ).

JavaScript has dynamic types

JavaScript has dynamic types. This means that the same variables can be of different types:

Instance

Var x; // x is undefinedvar x = 5; // now x is a number var x = "John"; // now x is a string

JavaScript string

A string is a variable that stores characters (such as "Bill Gates.

A string can be any text in quotation marks. You can use single or double quotation marks:


Instance

var carname="Volvo XC60";var carname='Volvo XC60';

You can use quotation marks in a string as long as they do not match the quotation marks surrounding the string:

Instance


var answer="It's alright";var answer="He is called 'Johnny'";var answer='He is called "Johnny"';

You will learn in the advanced section of this tutorial

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.