Javascript basics, basics of photography for beginners

Source: Internet
Author: User

Javascript basics, basics of photography for beginners

  • Javascript Introduction

Javascript has three important components: ECMAScript, DOM, and BOM.

ECMAScript is the core language defined by ECMA specifications. In fact, this language does not contain input and output definitions. The ECMA Specification defines only the basis of this language, on which a more complete scripting language can be built. Our common Web browser is only one of the possible hosting environments implemented by ECMAScript.

DOM is both a Document Object Model (Document Object Model) and an application programming interface for XML but extended HTML. DOM maps the entire page into a multi-layer node structure. Each component of an HTML or XML page is a type of node that contains different types of data.

BOM is a Browser Object Model that provides a series of objects and APIs that can operate on browsers.

 

  • Apply javascript code

There are two ways to apply javascript code to a page.

Method 1: insert javascript code into the <script> tag of the html document.

Directly wrap javascript code using the script tag in the document. In some earlier browsers, you must add the type = "text/javascript" attribute to the script tag to correctly identify javascript code.

Method 2: store javascript code in an independent file and introduce the javascript file through the src attribute of the script tag.

Write the js Code into a separate js file. When necessary, introduce the js file through the script tag in the document.

  • JavaScript syntax

1. Variables

Variables are defined by the var operator and the variable name.

Variable name naming rules: the first character must be a letter, underscore (_), or dollar sign ($); the variable name cannot contain spaces or punctuation marks (_) and $); variable names are case-sensitive. Reserved Words and keywords cannot be used. To make the variable name more readable, you can insert underscores to separate them.

2. Data Type

String)

The String type is used to represent a String that consists of zero or multiple 16-bit Unicode characters. The string can be composed of double
Quotation marks (") or single quotation marks (')

Number)

Number Type

Expressed in IEEE754 format
Integer and floating point value (the floating point value is also called a double-precision value in some languages ).

 

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.