1. 4주차, 5주차 2회독 및 예제 해결
2. 헷갈리는 메서드 연습
3. GIT 오류 해결 및 연습
1.
(1) week4
function fetchAndPrintJson(url) {
return fetch(url)
.then((response) => {
return response.json()
})
.then((data) => {
console.log(data);
});
}
fetchAndPrintJson('https://jsonplaceholder.typicode.com/posts/1');
async function fetchJson(url) {
const response = await fetch(url);
const data = await response.json();
console.log(data);
}
fetchJson('https://jsonplaceholder.typicode.com/posts/1');
(2) week5
const id = button.parentNode.parentNode.id;
console.log(`영화 제목은 ${this._title}, 감독은 ${this._director}, 개봉연도는 ${this._releaseYear} 입니다.`);
}
if (typeof newTitle !== 'string') {
console.log(`영화제목의 data type은 string 이어야 합니다. 현재 타입: ${typeof newTitle}`)
return;
} else if (newTitle.length == 0) {
console.log(`한 글자 이상의 문자열을 할당해 줘야 합니다.`)
return;
}
this._title = newTitle;
2.
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
console.log(result);
// Expected output: Array ["exuberant", "destruction", "present"]
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
// Expected output: "a"
// Expected output: "b"
// Expected output: "c"
const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };
const returnedTarget = Object.assign(target, source);
console.log(target);
// Expected output: Object { a: 1, b: 4, c: 5 }
console.log(returnedTarget === target);
// Expected output: true
3.
git 오류 해결
레파지토리 연동시킨 폴더 위치 잘못 됨
연동폴더>작업폴더 인 상황에서 작업폴더를 vscode에서 연 상태로 터미널에서 git push 시도하니까 작업폴더에 연결된 origin이 없는데? 상태가 됨
상위 연동폴더에서 터미널 열고 push 성공
branch, merge 연습
git add .(파일만 올릴거면 해당 파일이름)
git commit -m "commit message"
git checkout -b branch 브랜치이름
git push origin 브랜치이름
pull request
merge