Skip to content

Commit 7b46827

Browse files
committed
2 parents 50a4157 + 1472b1e commit 7b46827

11 files changed

+251
-0
lines changed

.DS_Store

2 KB
Binary file not shown.

2.보이는학생.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(arr) {
9+
let answer = 1;
10+
let maxheight = arr[0];
11+
12+
for (let h of arr) {
13+
if (h > maxheight) {
14+
maxheight = h;
15+
answer++;
16+
}
17+
}
18+
return answer;
19+
}
20+
21+
let arr = [130, 135, 148, 140, 145, 150, 150, 153];
22+
console.log(solution(arr));
23+
</script>
24+
</body>
25+
</html>

section1/10.문자찾기.html

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s, t) {
9+
let answer = 0;
10+
11+
for (const ele of s) {
12+
if (ele === t) answer++;
13+
}
14+
15+
return answer;
16+
}
17+
18+
let str = 'COMPUTERPROGRAMMING';
19+
console.log(solution(str, 'R'));
20+
</script>
21+
</body>
22+
</html>

section1/11.대문자찾기.html

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = 0;
10+
11+
for (let ele of s) {
12+
if (ele === ele.toUpperCase()) {
13+
answer++;
14+
}
15+
}
16+
17+
return answer;
18+
}
19+
20+
let str = 'KoreaTimeGood';
21+
console.log(solution(str));
22+
</script>
23+
</body>
24+
</html>

section1/12.대문자로통일.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
return s.toUpperCase();
10+
}
11+
12+
let str = 'ItisTimeToStudy';
13+
console.log(solution(str));
14+
</script>
15+
</body>
16+
</html>

section1/13.대소문자변환.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = '';
10+
11+
for (let ele of s) {
12+
const codeNum = ele.charCodeAt();
13+
14+
if (ele === ele.toUpperCase()) {
15+
answer += ele.toLowerCase();
16+
} else {
17+
answer += ele.toUpperCase();
18+
}
19+
20+
// if (codeNum >= 65 && codeNum <= 90) {
21+
// answer += ele.toLowerCase();
22+
// } else {
23+
// answer += ele.toUpperCase();
24+
// }
25+
}
26+
27+
return answer;
28+
}
29+
30+
console.log(solution('StuDY'));
31+
</script>
32+
</body>
33+
</html>

section1/14.가장긴문자열.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = '';
10+
let maxLength = 0;
11+
12+
for (let word of s) {
13+
if (maxLength < word.length) {
14+
answer = word;
15+
maxLength = word.length;
16+
}
17+
}
18+
19+
return answer;
20+
}
21+
let str = ['teacher', 'time', 'student', 'beautiful', 'good'];
22+
console.log(solution(str));
23+
</script>
24+
</body>
25+
</html>
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
// arr.slice([begin[, end]])
10+
// array.splice(start[, deleteCount[, item1[, item2[,
11+
let answer;
12+
13+
const mid = Math.floor(s.length / 2);
14+
//홀수일 때
15+
if (s.length % 2 === 1) {
16+
answer = s.slice(mid, mid + 1);
17+
}
18+
//짝수일 때
19+
else {
20+
answer = s.slice(mid - 1, mid + 1);
21+
}
22+
23+
//짝수일때
24+
return answer;
25+
}
26+
console.log(solution('stu'));
27+
</script>
28+
</body>
29+
</html>

section1/16.중복문자제거.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = '';
10+
11+
const map = new Map();
12+
13+
for (const ele of s) {
14+
if (!map.has(ele)) {
15+
map.set(ele, true);
16+
answer += ele;
17+
}
18+
}
19+
console.log(map);
20+
21+
return answer;
22+
}
23+
console.log(solution('ksekkset'));
24+
</script>
25+
</body>
26+
</html>

section1/17.중복단어제거.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(s) {
9+
let answer = [];
10+
11+
const map = new Map();
12+
13+
for (let word of s) {
14+
if (!map.has(word)) {
15+
map.set(word, true);
16+
answer.push(word);
17+
}
18+
}
19+
20+
return answer;
21+
}
22+
let str = ['good', 'time', 'good', 'time', 'student'];
23+
console.log(solution(str));
24+
</script>
25+
</body>
26+
</html>

section2/1.큰수출력하기.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" />
4+
<title>출력결과</title>
5+
</head>
6+
<body>
7+
<script>
8+
function solution(arr) {
9+
let answer = [];
10+
answer.push(arr[0]);
11+
12+
for (let i = 1; i < arr.length; i++) {
13+
if (arr[i] > arr[i - 1]) {
14+
answer.push(arr[i]);
15+
}
16+
}
17+
18+
return answer;
19+
}
20+
21+
let arr = [7, 3, 9, 5, 6, 12];
22+
console.log(solution(arr));
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)