2022-01-03 TIL

yeopto·2022년 1월 3일
0

TIL

목록 보기
14/24
post-thumbnail

해야할 것

  1. 노마드코더 바닐라JS #6 Quotes and Background - ⭕️
  2. 백준 단계별 문제풀기 - ⭕️

TIL

#javascript

  1. Math.round()는 소수점을 반올림 시킨다. ceil은 올림, floor은 버림.
  2. HTML요소를 javascript에서 만들고 싶을때는 createElement(”속성”)을 사용. 그 후 추가하고 싶으면 appendChild()사용. append는 마지막에 추가 prepend는 앞에 추가.

#BOJ

  1. 1000번 a+b
const fs = require('fs'); // fs모듈
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; // 백준 채점코드 플랫폼이 리눅스임 그래서 파일경로는 /dev/stdin 그렇지 않으면 내가만든 입력 텍스트파일
let input = fs.readFileSync(filePath).toString().split('\n'); // 입력 텍스트 파일을 통채로 문자열로 읽어서 개행으로 쪼갠 뒤(한줄씩) 배열로 저장

input = input[0];
input = input.split(' '); // split 메서드가 쪼갠 뒤 배열로 저장하는 메서드.

let input1 = Number(input[0]);
let input2 = Number(input[1]);

solution(input1, input2);

function solution(A, B) {
    console.log(A + B);
}

profile
https://yeopto.github.io로 이동했습니다.

0개의 댓글