Javascript Basics
1
talk about Javascript1.1
The historical source of Javascript
94 Netscape developed the world's first browser.
The birth of Sun 's java language
Netscape works with Sun .
Java+script ===> JavaScript
1.2
Specifications
? structure standard HTML
? Performance Standard CSS
? Behavior Standard JS
1.3
The relationship between JavaScript and ECMAScript
ECMAScript is a former European Association of Computer Manufacturers by ECMA International, the English name is European Computer Manufacturers Association, the standard set.
JavaScript is developed by the company, the company developed must be some problems, inconvenience to other companies to expand and use. So the European ECMA Organization, led the development of JavaScript standards, named ECMAScript.
Simply put, ECMAScript is not a language, but a standard. The more common criteria are: JavaScript, Action Script (the language in Flash). that is , your JavaScript is finished, and the program in Flash will write.
ECMAScript in June 2015, released the ECMAScript 6 version, the language of the ability to be stronger. However, browser vendors are not going to catch up with this standard so quickly. These new features, our employment class in-depth, will also be introduced to you.
1.4
today's JavaScript: Take more responsibility
before 2003, JavaScript was considered "cowhide fresh" , used to make ads on the page, pop-up windows, floating ads. What's annoying and what JavaScript is developing. So the browser has launched a blocking advertising function.
2004 JavaScript Fate began to change, that year Google, began to take the lead in the use of Ajax technology, Ajax technology is an application of JavaScript . And that's when people gradually started to improve their user experience.
In the 2010, when people learned more about HTML5 technology,HTML5 introduced a thing called canvas, which engineers can play on canvas, using JavaScript.
In 2011, node. JS was born, enabling JavaScript to develop server programs.
Today, JavaScript engineers are absolutely popular and can be as well as iOS and Android engineers, no less.
Now, companies are popular WEBAPP, is to use web technology to develop mobile phone applications. What do you mean? The mobile phone system has iOS, Android, Windows Phone. So companies such as the development of a "Ctrip" APP, you need to recruit three teams, such as iOS engineers 10 people, 10 Android engineers, Windows Engineers 10 people. A total of 30 people, pay a large cost. And, if you want to revise, you need to change 3 versions. So now companies are using web technology to develop apps with Html+css+javascript technology. The advantage is not to recruit so many engineers, only a few front-end development engineers can. And it is easy to iterate, that is, the web changes, all the terminals have changed.
2
Js Introduction
JS is a web programming language that runs on the client.
Part
★ECMAScript JS Standard
★DOM operation page elements via JS
★BOM Operation browser via API
Characteristics
★ Easy to use
★ Explain execution
compile and Execute Java C # into a. dll executable file ==> Computer reads the. DLL executable file
★ Object-based
Process oriented
Role
Form validation
Carousel Effects
Development game
3
Js Writing position
Inline type
Outer chain Type
★ Create an external JS file First
★ Call the external js via src .
When writing the JS Code, the semicolon cannot be omitted.
It is recommended to write the JS code behind the HTML end tag
Add multiple JS file together into a js file
4
several ways to output messages4.1
alert () pops up a dialog box on the page, using early JS debugging.
4.2
Confirm () pops up a dialog box on the page , often in conjunction with if judgment.
4.3
console.log () input information into the console for js Debugging.
4.4
The prompt () popup dialog box is used to receive information entered by the user.
4.5
document.write ()
output messages on page
document.write not only output information, but also output labels.
Escape character
\ " Turn double lead
\ ' Turn single citation
\ n Convert rows
\ r turn to enter
4.6
Js Comment
shortcut key ctrl+/
single-line comment //
Multiline Comment /* */
5
variables
The amount that will change.
A variable is a container used to store data.
Defining variables
Assigning values to variables
"=" is an assignment operator
Define and assign values
5.1
naming conventions for variables
You cannot define a variable name by starting with a number or a pure number.
It is not recommended to use Chinese to define variable names.
Cannot start with special symbols or special symbols (- except );
It is not recommended to use keywords and reserved words to define variable names.
★ Strictly distinguish the case in JS !!!
6
Data Type6.1
Simple data Types
number numeric type
include positive numbers Negative number decimal
How numeric types are expressed
★ Decimal notation
★ Hexadecimal notation
From 0-9,A (a)-F (f) represents a number. Start with 0x .
★ Octal notation
0 begins with0-7 composition.
Strings string
A string is usually caused by double quotes or single quotes.
Boolean Data Type Boolean
only 2 values one is true and the other is false. true=1,false=0 in the actual operation
Undefined variable not initialized
variable is defined and no value is assigned to the variable
NULL variable unreferenced value is null object
6.2
Complex data Types
★ Object Objects
★ Array Arrays
7
Judging data Types
typeof ()
8
comparison Operators
< > <= >= = = =!
9
Arithmetic Operators
+ plus
★ Two number types of variables added, the resulting is a number type.
★ A numeric type and a string are added, resulting in a string.
-Minus
★ Two numeric type variable subtraction, get a number type.
★ A numeric type is subtracted from a numeric string, resulting in a numeric type.
★ A numeric type and a non-numeric string subtraction, the resulting is NaN, is a numeric type.
NaN, not a number
/ Division sign
★ Two number types of variables to divide, the resulting is a number type.
★ A number type and a number string division, the resulting is a number type.
★ A numeric type and a non-numeric string divide, the resulting is NaN, is a numeric type.
★0 as a divisor, get the result Infinity (Infinity), is a number type.
% take remainder
Priority has () the first calculation ()
10
assignment operations with operations
javascript.01--JavaScript basics