Javascript is a dynamic scripting language for (based) objects. It is a scripting language based on Object and EventDriven and has security performance. He has various characteristics specific to object-oriented languages, such as encapsulation, inheritance, and polymorphism.
Javascript importance
Usage
1. In web applications, javascript is used in front-end interface programming;
2. Web2.0 and Ajax promote the javascript language.
3. As a large number of c/s applications turn to B/s, the rich client technology will be continuously promoted, and the application scope of javascript language will continue to increase;
Features of javascript
Simple
Dynamic
Object-based (Object-Oriented)
Javascript object-oriented Overview
Javascript is a dynamic scripting language for (based) objects. It is a scripting language based on Object and EventDriven and has security performance. It has various characteristics specific to object-oriented languages, such as encapsulation, inheritance, and polymorphism. But for most people, we only use javascript as a functional language, and only use it for some simple front-end data input verification and some simple page dynamic effects, we cannot fully grasp the features of dynamic languages.
In many excellent Ajax frameworks, such as ExtJS and JQuery, a large number of javascript object-oriented features are used. ext technology and advanced features of javascript must be used, object-oriented language features must be fully grasped.
Knowledge about Javascript
Development History of Javascript
Three major components of Javascript
ECMAScript
Syntax \ Data Type \ statement \ keyword reserved word operator object
DOM (Document Object Model)
BOM (Browser Object Model)
Discussion on the flexible features of JavaScript
1. Spiritual test of Dynamic Language
Javascript, as a dynamic language, has a very flexible sending. In the process of using Javascript, You need to flexibly master and apply its dynamic features to be handy.
Think about the output below
The Code is as follows:
Function Animal (name ){
This. name = name;
This. age = 0;
};
Var a1 = Animal; // output:
Var a2 = Animal (); // output:
Var a3 = new Animal (); // output:
Var a4 = new Animal; // output:
Data Types in Javascript
Basic Data Type
Number (Numbers)
String (Strings)
Boolean
Special values (null, undefined, NaN ).
Object Type
Objects are complex data types. Objects can contain basic types, objects, and functions. arrays are an object type. For javascript, it can be said that everything is an object, including a class !.
Var c = new Object ();
1. digit type
The numeric type is the basic data type in all languages. The numeric types in javascript mainly include INTEGER (Int) and Float (Float, however, both types are saved in the memory as floating points. The numeric type usually appears in a program in the form of a numeric constant in javascript. Generally, it is based on the 10-digit data, which is composed of the 10 digits 0-9, for example, the hexadecimal data starting with 0x (consisting of 16 characters including 0-9 and a to f, for example, converting 0xff to a 10-digit system is 255 (that is, 15*16 + 15 = 255). Some javascript implementations also support 8-digit data, that is, the data starting with 0 (consisting of the eight numbers 0-7). For example, if the octal value of 0377 is converted into a decimal number, it is 255, that is, (3*64 + 7*8 + 7 = 255 ).
2. Character Type
A string consists of various characters, numbers, and special strings. You can directly use single quotes or double quotes in a program to generate a String constant. There cannot be carriage return characters in the string. To include the carriage return character in the string, you must use an escape character. Below are some simple string constants:
"" // The empty string: it has zero characters
'Testing'
"3.14"
'Name = "myform "'
"Wouldn't you prefer O 'Reilly's book? "
"This string \ nhas two lines"
"π is the ratio of a circle's circumference to its diameter"
3. Boolean
Boolean is used to represent true or false. In javascript, when used for Boolean operations, data except 0, null, null, undefined, NaN, etc. all represent true.
If (0 | "" | false | null | undefined | NaN) alert ("A condition returns true ");
Boolean constants are only false and true. False and True are not constants.
4. Object Type
Javascript is an object-based language, and objects are its core.
Program Process Control
Sequential Structure
If condition selection statement
Switch selection statement
While loop statement
Do while statement
For Loop statement
Break and continue statements
For... in loop statement
For (variable in set or object)
{
Execution statement Block
}
The Code is as follows: