1. What is JavaScript?
javaScript is a scripting language and an interpreted language, or a weakly typed language
A weakly typed language: the type of data determined by the value of the variable
2, JavaScript what constitutes?
javaScript consists of three parts, namely: core ECMAScript --- core syntax, DOM --- Document Object Model, BOM --- browser object model;
3, how to use JavaScript?
javascript three different ways:
Internal Style --- write js code in the Script Tags
External style --- js code written in an external js file js file needs to be introduced
Inline style --- in property (event attributes, etc.) inside the tag write js code
3.js use what?
1> end use customers aspects:
Form input validation
Asynchronous processing of data submitted to the server (AJAX)
Complete pages of some special effects
Computing the client's data
Browser time triggering and processing
2> use the server are:
Distributed computing
Real-time server
Application window
Network applications, etc.
4. What are the variables?
Variable is the memory of the period of storage space, the purpose is to temporarily hold data;
Declare variables ---
var variable name = variable value;
Variable named norm ---
JS does not allow the use of keywords and reserved words
It can contain letters, numbers, underscores (_) and $
Variable names can not start with a number
It can be used: hump Hungarian underlined name ....
type of data---
fractional and integer number can represent 32-bit integer can be represented by 64-bit floating point
need string '' or '' includes a character string type is accounted for two
boolean Boolean value
undefined undefined
null null set
Reference data types object
Operation ---
string + number = string
string + boolean = string
number + boolean = number
number + undefiend = NaN
boolean + undefiend = NaN
string + undefiend = string
js function ---
isNaN (data) of the digital detection data is non
Mandatory data type conversion:
toString () ---- .toString data () to convert any data string
parseInt (data) --- convert the data type is an integer type, number
parseInt("2a5.a64")> 2
parseFloat (data) --- type data is converted to floating point number
parseFloat("1.9a2") 1.9
Number (data) contains non-numeric characters long, return NaN
5. expand assignment expression
+= -= *= /= %= &= |= ^=
Syntax: a + = b corresponds to the effect of a = a b +
Operational conditional operator trinocular
Unary operator
++ -- !
Binary operator
+ - * / % && || ^ & | > <
Ternary operator
It requires three operands / Expression Expression 1 Expression 2: Expression 3;?
Expression 1: Operation result should be a boolean
1 expression is true if the expression is executed 2
1 expression is false if the expression is executed 3
Trinocular operation is allowed nested
E.g:
Judgment results, if the score> = 80 outstanding
> = 60 passing
<60 fail
var score = prompt ( "Enter Results:");
var msg = score> = 80 "excellent": score> = 60 "qualified": "fail";??
console.log(msg);
6. The relational operators
> <> = <= ==! = ===! == final result must be a boolean
== determines whether the two data are equal values
! = Not equal, it is determined whether the two data are not equal to the value
=== values and determines whether the type of exactly equal
! == type and determines whether the value is not equal to complete
<1 .string number and size is determined, the number is converted to a string type implicitly by Number () function
<2. When any data is compared with a NaN, necessarily result to false 30a is converted to NaN
<Analyzing 3.string size between string and comparing it with the code for each character unicode
7. Logical Operators
Action: determining a relationship between a plurality of conditions
Multiple && conditions must be satisfied to see false is false
And short-circuit: as long as the first condition is false, the result of the entire expression are false, and the second condition is not to judge
|| satisfies one of the conditions is true See true
Short circuit or: as long as the first condition is true, the entire expression result is true, and not to judge a second condition
! Negate
8. Bitwise
Only do digital operations, and want to convert binary numbers, doing arithmetic
& Bitwise AND operation on both sides of the number of converted into binary numbers each, as long as the time corresponding to both 1, then the result of this bit is 1, otherwise, the bit 0 is the result
E.g:
was num1 = 5;
was num2 = 3;
var r = num1 & num2 ;
console.log(r);
5: 101
3: 011
------------
r: 001
Action: determining a parity, to be higher than the efficiency of the mold
Analyzing the figures do bitwise 1, the last one is even 0 1 odd
console.log ((10 & 1) === 0); // true even number
console.log ((9 & 1) === 0); // false odd
10: 1010
1 : 0001
----------
0000
11: 1011
1 : 0001
--------
0001
9. commonly used browsers
The core role of the browser:
Kernel: responsible for rendering the page content
Content layout engine - is parsed HTML / CSS
Script interpreter engine - parsing JS
According to the classification of the browser kernel are as follows:
The name of the browser core layout engine script interpreter engine
IE Trident - (kernel comes) Chakra
Firefox Gecko - Monkey Monkey --- Firefox
Chrome Webkit webcore V8 --- Google
Safari Webkit webcore Nitro --- Apple
Opera Webkit webcore V8 --- European friends