forked from DrSkippy/Data-Science-45min-Intros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello-d3.html
58 lines (51 loc) · 1.5 KB
/
hello-d3.html
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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
body {
color: red;
font-family: sans-serif;
}
</style>
</head>
<body>
<script src="http://d3js.org/d3.v2.js"></script>
<script>
var a = 5; //global scope is forced without the use of var
function return_global_a() {
return a;
}
function return_global_b() {
return b;
}
function test1() {
console.log("a in function scope:",a);
console.log("a in global scope:",return_global_a());
};
function test2() {
var a=2;
console.log("a in function scope:",a);
console.log("a in global scope:",return_global_a());
};
function test3() {
a=3
console.log("a in function scope:",a);
console.log("a in global scope:",return_global_a());
};
function test4() {
var a=7
console.log("a in function scope:",a);
console.log("a in global scope:",return_global_a());
};
function test5() {
b=2
console.log("b in function scope:",b);
console.log("b in global scope:",return_global_b());
};
function test6() {
console.log("b in function scope:",b);
console.log("b in global scope:",return_global_b());
};
d3.select("body").append("p").text("D3-101")
</script>
</body>