Data type of JS base

Source: Internet
Author: User

One: JavaScript data type: string, Number, Boolean, array, object, Null, Undefined

JavaScript string;

var carname= "Bill Gates";

JavaScript numbers;

var x1=34.00; //Use a decimal point to write

var x2=34; //Do not use decimal point to write

JavaScript Boolean;

var x=true;var y=false

JavaScript arrays;

var cars=new Array ();
Cars[0]= "Audi";
Cars[1]= "BMW";
Cars[2]= "Volvo";

JavaScript object;

var person={firstname: "Bill", LastName: "Gates", id:5566};
Name=person.lastname;
name=person["LastName"];

Undefined and Null;

Undefined This value indicates that the variable does not contain a value.

You can empty a variable by setting the value of the variable to null.

Declaring variable types

When you declare a new variable, you can use the keyword "new" to declare its type:

var carname=new string;var x=      new Number;var y=      new Boolean;var cars=   new Array;var person= new Object;

Two: JS operator

Base: +,-, *,/,%,++,--; =,+=,-=,*=,/=,%=;

Advanced: ECMAScript unary operator, ECMAScript bitwise operator, ECMAScript Boolean operator, ECMAScript multiplicative operator, ECMAScript additive operator, ECMAScript relational operator, ECMAScript operator, ECMAScript conditional operator, ECMAScript assignment operator, ECMAScript comma operation character;

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.