-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.html
86 lines (65 loc) · 2.26 KB
/
hello.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
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
<html>
<body>
<canvas width="600" height="600"></canvas>
<script>
let canvas = document.querySelector('canvas');
let context = canvas.getContext('2d');
context.fillStyle = 'blue';
// context.fillRect(100, 100, 400, 400);
context.lineWidth = 4;
// context.beginPath();
// context.rect(100, 100, 400, 400);
// context.stroke();
// context.beginPath();
// context.arc(300, 300, 100, Math.PI / 2, 0);
// context.stroke();
const width = 60;
const height = 60;
const gap = 20;
let x, y;
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
x = 100 + (width + gap) * i;
y = 100 + (height + gap) * j;
context.beginPath();
context.rect(x, y, width, height);
context.stroke();
if (Math.random() > 0.5) {
context.beginPath();
context.rect(x + 8, y + 8, width - 16, height - 16);
context.stroke();
}
}
}
let year = 2042;
let nextYear = year + 1;
let years = [];
let menu = ['starter', 'main', 'dessert', 'drinks', 'sides'];
for (let i = 0; i < menu.length; i++) {
console.log(menu[i]);
}
for (let i = 0; i < 10; i++) {
years.push(2040 + i);
}
console.log(years);
menu.forEach(item => {
console.log(item);
});
let dinner = 'pasta';
let sentence = 'Tonight, dinner will be ' + dinner;
function saySomething(param) {
console.log(param);
}
saySomething(sentence);
function add(a, b) {
return a + b;
}
let result = add(5, 2);
console.log(result);
let multiply = (a, b) => {
return a * b;
}
console.log(multiply(5, 7));
</script>
</body>
</html>