Common Grammar of 003_01javascript

Source: Internet
Author: User

What is JavaScript?

Netscape is an object-and event-driven scripting language developed by the company and can be run in all major browsers IE, Firefox, Chrome, and Opera JavaScript are designed to add interactivity to HTML pages.

No compilation is required and the browser can interpret the run directly.

JavaScript is a weakly typed language.

The official name of JavaScript is "ECMAScript". This standard is developed and maintained by the ECMA organization.

Features: interactivity (what it can do is dynamic interaction of information)

Security (does not allow direct access to local hard disks)

Cross-platform (as long as the browser can interpret JS can be executed, and platform-independent)

JavaScript language composition

A complete JavaScript implementation consists of the following 3 parts:

Core (ECMAScript)

Document Object Model (DOM)

Browser object Model (BOM)

How JavaScript is combined with HTML

  HTML <script> tags for inserting JavaScript into HTML pages

Two ways of writing javascript: internal JS and external JS

Internal JS program, in the HTML source code

<script type= "Text/javascript" > Alert (1); </script> Language property is deprecated, use the Type property instead

External JS program, the introduction of a separate JS program in HTML 

<script src= "1.js" ></script> cannot write JavaScript code between script tags referencing external js

1.js Content

Alert (2);

JavaScript basic syntax

variables, functions, and operators are case-sensitive

The variable is a weakly typed var a = 10; var B = true; var c = "Hello";

At the end of each line;

Data types for JavaScript

  5 Raw data Types Undefined, Null, Boolean, number, and String

View variable types with the TypeOf operator

Solving typeof Object Type judging problem by instanceof operator

Distinguish between undefined and null:

A variable defines an uninitialized/accessed object that does not exist---undefined

The object accessed does not exist---NULL

Introduction to JavaScript Common objects

  Array object, array manipulation

A String object-----a reference type of type var s = new String ("Itcast");

The Number object----The numeric primitive type reference type var n = new numbers (100);

Boolean object----BOOL Primitive type reference type var b = new Boolean (true);

Math Object performs mathematical tasks

Date objects are used to process dates and times

RegExp Object Regular Expression object

Definition of JavaScript functions

  Mode one function add (A, B) {return a + C;} function does not need to define return value, can return directly

Mode two var add = function (A, b) {return a+b;}

JavaScript Global Functions

  IsNaN Check if a value is a number

Parseint/parsefloat parsing strings as integers/floating-point numbers

Eval computes the JavaScript string and executes it as script code

Escape with Unescape, encodeURI () and decodeURI ()

Common Grammar of 003_01javascript

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.