Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[201900786 전소영] 1주차 미션을 제출합니다. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pages/1. 입력 및 출력/a와 b 출력하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

let input = [];

rl.on('line', function (line) {
input = line.split(' ');
}).on('close', function () {
console.log('a = ' + input[0]);
console.log('b = ' + input[1]);
});
19 changes: 19 additions & 0 deletions pages/1. 입력 및 출력/문자열 반복해서 출력하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

let input = [];

rl.on('line', function (line) {
input = line.split(' ');
}).on('close', function () {
str = input[0];
n = Number(input[1]);
let res = '';
for(let i = 0; i<n; i++){
res += str;
}
console.log(res);
});
14 changes: 14 additions & 0 deletions pages/1. 입력 및 출력/문자열 출력하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

let input = [];

rl.on('line', function (line) {
input = [line];
}).on('close',function(){
str = input[0];
console.log(str);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function solution(my_string, n) {
var answer = '';
for(let i =0; i<my_string.length; i++){
for(let t=0; t<n; t++){
answer += my_string[i];
}
}
return answer;
}
5 changes: 5 additions & 0 deletions pages/2. 사칙연산 및 배열/배열 두 배 만들기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function solution(numbers) {
var answer = [];
answer = numbers.map(n => n*2);
return answer;
}
3 changes: 3 additions & 0 deletions pages/2. 사칙연산 및 배열/배열 뒤집기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function solution(num_list) {
return num_list.reverse();
}
5 changes: 5 additions & 0 deletions pages/2. 사칙연산 및 배열/배열 자르기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function solution(numbers, num1, num2) {
let answer = [];
answer = numbers.slice(num1, num2+1);
return answer
}
9 changes: 9 additions & 0 deletions pages/2. 사칙연산 및 배열/배열의 평균값.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function solution(arr) {
var answer = 0;
let sum = 0;

for (let i = 0; i < arr.length; i++){
sum += arr[i];
}
return answer = sum / arr.length;
}
3 changes: 3 additions & 0 deletions pages/2. 사칙연산 및 배열/숫자 비교하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const solution = (num1, num2) => {
return num1 === num2 ? 1 : -1
}
3 changes: 3 additions & 0 deletions pages/2. 사칙연산 및 배열/중앙값 구하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function solution(array) {
return array.sort((a, b) => a - b)[Math.floor(array.length / 2)];
}
5 changes: 5 additions & 0 deletions pages/2. 사칙연산 및 배열/최빈값 구하기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function solution(numbers, num1, num2) {
let answer = [];
answer = numbers.slice(num1, num2+1);
return answer
}
6 changes: 6 additions & 0 deletions pages/3. 조건문/각도기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function solution(angle) {
if(angle < 90) return 1;
else if(angle == 90) return 2;
else if(angle < 180) return 3;
else return 4;
}
4 changes: 4 additions & 0 deletions pages/3. 조건문/특정문자 제거.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function solution(my_string, letter) {
const answer = my_string.split(letter).join('')
return answer;
}
Empty file.
Empty file.