-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjs_basics_4.html
More file actions
94 lines (73 loc) · 2.18 KB
/
Copy pathjs_basics_4.html
File metadata and controls
94 lines (73 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<script>
"use strict";
//array
//create
var anArray = new Array();
var anotherArray = Array();
var yetAnotherArray = [];
//alert(typeof anArray + typeof anotherArray + typeof yetAnotherArray);
//var anArray = new Array('12','qwqw');
//anArray.length = 5;
//alert(anArray);
var anArray1 = new Array('12');
var anArray1 = new Array(12);
//alert(typeof anArray1);
var anotherArray = Array(11,'12','qwqw');
//alert(typeof anotherArray.toString());
//alert();
anotherArray[30] = 'I am at postion 30';
//console.log(anotherArray + "\n"+ anotherArray.length);
anotherArray['assoc'] = 'I am assoc';
anotherArray[3.14] = 'I am 3.14';
//alert(anotherArray + "\n"+ anotherArray.length);
//alert(anotherArray['assoc']);
//alert(anotherArray.assoc);
//alert(anotherArray[3.14]);
//alert(anotherArray.3.14);
//alert(anotherArray.3.14);
/*
console.log(anotherArray);
var yetAnotherArray = [];
//alert(typeof anArray + typeof anotherArray + typeof yetAnotherArray);
var anObject = new Object();
anObject['aAssoc'] = 'aAssoc';
anObject.aAssoc = 'aAssoc2';
anObject[12] = 12;
//anObject.12 = 123;//invalid: error
anObject['12'] = '13';
//anObject.'145' = '145'; //invalid: error
//anObject.'aaa' = 'aaa'; ////invalid: error
//anObject.aAssoc = new Object();
anObject.aAssoc.a = 'aAssoc a';
console.log(anObject.aAssoc.a);
var anObject = new Array();
anObject['aAssoc'] = 'aAssoc'; //valid:property
anObject.aAssoc = 'aAssoc2'; //reassing
anObject[12] = 12; //valid: in position 12
//anObject.12 = 123;//invalid: error
anObject['12'] = '13';
//anObject.'145' = '145'; //invalid: error
//anObject.'aaa' = 'aaa'; ////invalid: error
anObject.aAssoc = 'aAssoc a';
//anObject.length = 0;
console.log( anObject.toSource() );
*/
var yetAnotherArray = ['12','13abc',['12','13abc'],'we'];
var yetAnotherArray = Array('12','13abc','we');
yetAnotherArray[2] = Array('12','13abc');
console.log(yetAnotherArray);
//
var sum = 0;
function add(){
//return 0;
sum = arguments[0] + arguments[1];
alert(sum +"w/ param");
}
function add(a,b){
//return 0;
//return arguments[0] + arguments[1];
sum = a + b;
alert(sum +"-param");
}
add();
</script>