JS Programming 01--Basic Concepts

Source: Internet
Author: User

This is the JS Advanced Program Design Study notes, notes I learn some of JS's experience of the demo, like a friend can directly refer to the original book "JavaScript Advanced Programming", the purpose of writing a note is easy to error in JS, difficult to understand the place to make a note, so as not to continue to trample the pit later.

1. Grammar

    • Case-sensitive: for example, typeof is used to test data types, unlike TypeOf, a Func can be defined as typeof
    • Identifier: The first character must be a letter, underscore, or $, followed by a number, letter, underscore, or $; identifiers cannot use System keywords and reserved words such as Var, true, false, NULL, let, etc.
    • Strict mode:

Strict mode is the concept introduced in ECMAScript 5, is a mechanism for the definition of JS and execution model, but also to be compatible with the old version of the ECMAScript version of the introduction, is a kind of compilation instructions, you can determine the ECMAScript 3 version of the compilation runtime of some of the indeterminate behavior. Using "Use strict", the method is as follows:

function say () {  "use strict";  Console.log ("Hello strict mode");} Say ();

2. Variables

    • All uninitialized variables are always undefined, regardless of the variable type:
function say () {  var message = "Hello message";} Say (); alert (message);  Message is not defined as undefined

However, if the VAR keyword is omitted, the message automatically rises to a global variable without error:

function say () {  = "Hello message";} Say (); Console.log (message);

Results:

    • The initialization of variable declarations allows simultaneous, such as:
var m1 = "1", M2 = "2", M3 = [];console.log (M1); Console.log (m2) ; Console.log (m3);

JS Programming 01--Basic Concepts

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.