-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkoss.js
62 lines (48 loc) · 1.43 KB
/
koss.js
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
for (var n = 2;n<=9;n++){
console.log('====' ,n,'단 시작 ====');
for (var i =1;i<=9; i++){
console.log(n, "*", i, "=", 2*i);
}
}
const date = new Date(2017, 9, 3, 18, 20, 30);
console.log('date : %s', date.toLocaleString());
console.log('LocaleDateString : %s', date.toLocaleDateString());
console.log('LocaleTimeString : %s', date.toLocaleTimeString());
console.log('year : %s', date.getFullYear());
console.log('month : %s', date.getMonth());
console.log('date : %s', date.getDate());
console.log('hours : %s', date.getHours());
console.log('minutes : %s', date.getMinutes());
console.log('seconds : %s', date.getSeconds());
const maxResult = Math.max(95, 80, 88, 79, 50);
const minResult = Math.min(95, 80, 88, 79, 50);
function sum(a,b){
return a+b;
}
function average(a,b){
return (a+b)/2;
}
console.log('max : ', maxResult);
console.log('min : ', minResult);
console.log('sum : ', sum(maxResult, minResult));
console.log('average : ', average(maxResult, minResult))
const students = [
{name : 'kyeongrok', score:85},
{name: 'jihyun', score: 95},
{name: 'minsup', score: 76}
];
function getDegree(score){
if(score >= 90){
return 'A';
} else if (score >=80){
return 'B';
} else if (score>=60){
return 'C';
} else {
return 'F';
}
}
students.forEach((k )=> {
const result = `name: ${k.name}, score: ${getDegree(k.score)}`;
console.log(result);
})