13:23~14:30 the 2nd Chapter
-------------------------------------------------------------------------------------------
1. Data type
Variable name: Alpha-Numeric $ _ (first not allowed to be a number)
Underline separate each word
Function name: Hump format named Mymode
-------------------------------------------------------------------------------------------
2. Declaring variables that do not require a type declaration: weak type
var a = ' don\ ' t ask '
var a = "don ' t ask"
var a =-3.22222 (any decimal place)
-------------------------------------------------------------------------------------------
3. Arrays
var AA = Array (4);
var AA = Array ();
Aa[0] = "John";
var AA = Array ("RR", "true");
var AA = ["RR", (), true];
var aa =array ();
var bb = [];
-------------------------------------------------------------------------------------------
4. Objects
var Lennon = Object ();
Lennon.name = "John";
var lennon = {na me: "John", year:1940, living:false};
-------------------------------------------------------------------------------------------
5. Compare
var a =false;
var B = "";
if (a = = b) {
Alert ("A is B");
}else{
Alert ("a isnot B");
}
= = Comparison Value
= = = Comparison Value and type
! = Comparison Value
!== comparison values and types
Logic && | | !
-------------------------------------------------------------------------------------------
6. Cycle
var count = 1;
while (Count <=11) {
alert (count);
count++;
}
bo=
alert (count);
count++;
}while (COUNT<11);
for (var count =1;count<11;count++) {
alert (count);
}
var AA = ["Ruj", [+], false];
for (var count =0;count<aa.length;count++) {
alert (count);
}
-------------------------------------------------------------------------------------------
7. Functions
var----local variables in a function
No var----global variables
-------------------------------------------------------------------------------------------
var jeremy = new Person; Jeremy has the properties and methods of person
Built-in objects: Array Date math and so on
var current_date = new Date ();
var today = Current_date.getday ();
Host objects: predefined objects provided by the browser: Document FORM element, etc.
[2015-12-10 profile] see a little every day [Javascript.dom Programming Art (2nd edition)]