JavaScript (1)-ecmascript

Source: Internet
Author: User

Directory:

JavaScript (1)-ecmascript

JavaScript (2)-ecmascript

 

I strongly recommend my jquery. Ajax series articles to you. Click to view them.

 

Reference:

 

Do you really know JavaScript? Many people regard it as a younger brother with imperfect functions and non-standard syntaxes in object-oriented languages such as Java, and even have no worries about it.

 

Today, more and more programmers are engaged in the development of the B/S model. With the rise of Ajax, JavaScript has been pushed down to the flashlight, and we suddenly find that JavaScript is not an easy-to-Master technology, it involves almost all the features of process-oriented, object-oriented, and functional programming languages. It is extremely flexible and has unlimited potential. I also do my best to combine the wisdom of my predecessors, summarize your experience for your reference.

 

To declare it, I will not go into details about JavaScript and its origins. If you don't have a computer foundation and want to add some interactivity to your website, Please bypass it, copy and paste it directly to Baidu.

 

Let's start with the implementation of JavaScript. A complete JavaScript implementation consists of the following three parts:

 

Ecmascript (CORE) describes JavaScript syntax and basic objects. Javscript, JScript, and ActionScript are all implemented based on the ecmascript standard. Therefore, ecmascript is actually a script standard in terms of syntax and semantics.

 

Dom (Document Object Model) is an application interface of HTML and XML, that is, an API interface. It plans the entire page as a document at the node level.

 

BOM (Browser object model) is a method and interface for interacting with the browser. For example, move the window and change the text in the status bar. Because there is no Bom standard, Each browser has its own BOM implementation.

 

Next we will analyze the core ecmascript syntax basics of JavaScript. The purpose is to gain a deep understanding of how JavaScript works.

 

It mainly involves the following:

Variable:

Of course, as a qualified programmer, the correct syntax does not meet our requirements. variable naming should also follow the following famous naming rules:

 

Camel flag: the first letter is lowercase, and the word starts with an uppercase letter. For example, VAR newtextvalue = "helloworld ".

Pascal markup: both start with an uppercase letter. Example: VaR
Newtextvalue = "helloworld ".

Hungary markup: Add a lowercase letter before the variable name named by Pascal, indicating the type of the variable, such as S string and I integer.

Data Type:

Original Type: variables of this type are simple data segments stored in the stack, that is, their values are directly stored in the location where the variables are accessed.




Reference Type: A reference type variable is an object stored in the heap. That is, the value stored in the variable is a pointer pointing to the memory of the storage object.

 


Object class:



Boolean class:



Number Type:



String class:



Two more functions

 

Typeof: Type of the returned variable or value.

 

For example: var stest = "my string ";

Alert (typeof stest); // outputs "string"

 

Return Value

Parameter type

Undefined

Undefined

Boolean

Boolean

Number

Number

String

String

Object

Reference type or null

 

 

Instanceof: when you use the typeof operator to store the value of the reference type, a problem occurs. No matter what type of the referenced value is, it returns "object ", therefore, instanceof is introduced to solve this problem. The instanceof method requires the programmer to explicitly confirm that the object is of a certain type.

For example:

VaR sobject = newstring ("mytest ");

Alert (sobject instanceof string); outputs "true"


Type conversion:

 

Summary:

Today, I wrote about the basics of JavaScript core ecmascript, including variables, data types, and type conversion. This helps us to understand the principle of Javascript in depth. We will continue to write ecmascript next time.

 

In this article, all the components are taken from the Mind Map mindmanager.

 

I will continue to write this article today. Finally, I want to say that if you just want to add some silly interactions to the web page, please skip this series of articles.

Welcome to shoot bricks

Related Article

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.