-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02.js
More file actions
92 lines (68 loc) · 1.38 KB
/
02.js
File metadata and controls
92 lines (68 loc) · 1.38 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
// var a = 0;
// function hello() {
// a = 1;
// b = 2;
// var c = 3;
// }
// hello();
// console.log(a);
// console.log(b);
// console.log(c);
// var x = "there"
// function a(){
// console.log(x)
// }
// function b(){
// var x = "here"
// a()
// }
// b()
// function bye (callback)
// {
// if(typeof callback === 'function') //防呆機制
// {
// callback()
// }
// }
// const cal = ()=>{ console.log('call') }
// bye(cal) // a callback
// let x = 3
// bye(x)
// let x, y = (1, 2)
// console.log(x)
// console.log(y)
// const a = ()=>{
// console.log('hello world')
// }
// setTimeout(a, 2000);
// setTimeout(function(){
// console.log('hello world');
// }, 2000);
function printStars2(num){
// let star =''
// let space = ''
// for(i = 1 ; i <= num ; i++ ){
// space = ' '.repeat(num-i)
// star = "*".repeat(i)
// console.log(space + star)
// }
}
// function printStars2(num){
// let star = ''
// let space = ''
// for(i = 1; i <= num; i++){
// space = " ".repeat(num-i)
// star = "*".repeat(i)
// console.log(space + star)
// }
// }
printStars2(100)
function printStars2(num){
let star =''
let space =''
for (let i = 1; i <= num; i++) {
space = ' '.repeat(num-i)
star = '*'.repeat(2*i-1)
console.log(space + star)
}
}