Study notes crossing a javascript "JS introduced entry, js introduction of variable, value type, operator"

Learning address: https: //ke.qq.com/user/index/index.html#/plan/cid=417875&term_id=100498562
code for the crossing a education, if the problem can contact deleted. Thank you!

1. major browsers
IE Trident
Chrome WebKit / Blink
Firefox Gecko
Opera Presto
Safari WebKit
2.js language ① ② single-threaded interpretive language

3. The introduction of js
page-level introduction

Print statement: document.write ( 'hello world !!!')

External introduced: the introduction of an external js file

4. Development Standard: html structure style css phase separation behavior js

The simultaneous introduction page + external, external commencement

6.html + css scripting language
js programming language, there are variables (storing things, to facilitate subsequent use)

7. Create variables: var (keyword)
var: a; declare variables is to apply for a place a
a = 100; assignment, the existence of this place a value of 100
defined variable assignment to write together +
var a = 100;
· · · ·················································· ················
var A = 100;
var B = 200 is;
var C = 300;
document.write © print statement
to link all the writing (written specification development):
var A . 1 =,
B = 2,
C = 100;
document.write (A, B, C)
multivariate single format var

8. overwriting assignment
var A = 10;
A = 20 is;
A = 30;

9. named variables:
the beginning of 9.1 (last name) only letters, underscores _, $
9.2 name (name) letter, underscore _, $, digital
9.3 & keyword reserved words as variable names can not be used.
// variable named semantics as much as possible

10. The variable calculating
var A = 10;
var = 20 is B;
C = A + B;

11. The data type of
the original value of
number string boolean undefined null
numbers: 12312314214 (born float)
string: a "", ''; abc, Deng brother very knock chen
Boolean; 0. 1 to false ture
undefined: undefined
null: Representative empty meaningless placeholder

Reference value
Array Object function DATE regexp
Array array: var arr = [1,2,3]

js programming language: determined by the value type (dynamic interpreted language)
var A = 10;
var A = B;
A = 20 is;
document.write (A), 10 to print the result

ARR = var [. 1];
var = ARR of arr1;
arr.push (2);
document.write (of arr1) print result 1
12 the original value and the reference value storage location is not the same:

Original value (unchangeable) reference value
stack Stack heap stack
var ARR = [1,2];
var = ARR of arr1;
ARR = [l, 3];
document.write (of arr1) print result 1,2
Here Insert Picture DescriptionHere Insert Picture Description
var NUM = 100;
num1 NUM = var;
var NUM = 200 is;
document.write (num1) print result 100
Here Insert Picture Description

································································································

13. The use of code end; end
without adding a
function Test () {}
for ()} {
IF () {}

var a = 1; = ± longitudinal any symbols remaining spaces
14. The two types of error
1. lower error (error parsing)
line of code is not executed, a block error does not affect the second block
2. The error logic (standard error, extenuating)
Here Insert Picture Description
15. operators operators
+ addition: digital computing, string concatenation (connection action)
var a = 'ABC';
var B = '123';
C = a + B;
Document. write ©, a print result abc123
var +. 1. 1 + A = 'ABC' print result 2ABC
var +. 1. 1 + A = 'ABC' + (. 1 + 2) print result 2abc3

- Minus:
* Multiplication:
/ Divide: 0/0 = Not A Number print NaN3
1/0 print infinity infinity
-1/0 print -infinity negative infinity
% 5% 1 I have taken more than 0 5
= equal sign: assignment
() brackets highest priority

No. ++
var A = 10;
var A = A +. 1; simplified + A
A is printed. 11
var A = a -. 1; simplified a -

A 10 = var;
var b = ++ A - 1 + A ++;
document.write (A + "" + A); print the results of 2112
than a decade of engineers to write code that no one can understand called Great God, who also read Shabi

+ =号
had a = 10;
a + = 10 + 1;

===========================================

16. Exercise
Here Insert Picture Description
var A = (-4/2. 3 * 10 + 1'd) 2%,
B =. 3;
B = A +%. 3;
document.write (A ++) print result. 1
document.write ( '
');
Document .write (-b) print result 2 (03 I obtained is equal to 1 minus 2)
Here Insert Picture Description
how to meet in front of the first printing operation and then, after the first printing operation in the adding calculation.

There are a = 123,
b = 234,
c = a,
a = b;
b = c;

Released five original articles · won praise 4 · Views 145

Guess you like

Origin blog.csdn.net/qq_44152977/article/details/104079443