-
항해 99 5기 WIL_2항해 99 2022. 1. 23. 23:26
▶ Weekly I Learned (회고)
<알고리즘>
프로그래머스 Level 1수준의 알고리즘 문제 30여개를 풀었다. 아직 갈 길이 멀지만
문제를 마주쳤을 때 어떻게 해결해야되는지에 대한 기본적인 틀이 잡혔다고 생각한다.
수료할때 쯤 최대한 level 2 ~ 3 수준이 되고 싶다.
물론 필요한 기능을 구현하는 능력도 겸비한 채.
<CS 스터디>
CS공부에 대한 갈망이 있었는데 이 스터디로 조금이나마 해소하고 있다. 컴퓨터에 대해 알면 알수록 배울 것이 참 많지만
그만큼 내가 성장할 여지가 많다는 점이 즐겁게 다가오기도 한다.
당장에 주어진 과제들을 하기에도 바쁘지만 기본 정도는 다 알고 가도록 하자 :)
<비동기 처리 방식>
완전히 깊이 있게 이해한 것은 아니지만 구글링하고 강의를 들으며 이제 기본 가닥은 잡힌 것 같다.
자바스크립트는 non-blocking model에 비동기 처리방식을 사용하고 있다.
즉, 앞의 코드가 완전히 실행되지 않아도 뒤의 코드가 실행된다.
이런 비동기 처리방식으로 인해 데이터가 넘어오기도 전에 출력 코드가 실행되는 문제가 발생했고
이를 해결하고자 콜백함수, 프로미스, async와 await 같은 방법들이 사용되었다.
<ES>
[ES]
ECMAScript의 약자, 우리가 아는 그 Javascript의 표준 규격이라 할 수 있음.
자바스크립트는 과거 넷스케이프에 사용할 동적인 요소를 위해 만들어짐
-> 다른 브라우저들도 탑재하기 시작하였고 브라우저마다 다른 규격의 자바스크립트를 사용하게 됨
-> 모두가 공통된 규격의 자바스크립트를 쓰도록 하기 위해 ECMA International에서 표준 개념인 ECMAScript를 만들게 됨
[ES5 & ES6]
위 ECMA 스크립트의 6번째 버전 (2015년도에 나왔기에 ECMA2015라고도 함)이 바로 ES6이다.
ES5(ECMA2009)와는 차이가 나는데 그 차이점들은 다음과 같다.
1) 변수 선언 시 let, const 추가
- var의 경우 전역이 스코프이며 호이스팅이 일어나기 때문에 사용을 권장하지 않기도 함.
게다가 var은 함수 선언문인 자기자신 생략 가능
- let과 const는 블록레벨 스코프임, 함수나 조건문, 반복문 안에서
사용된 let이나 const는 그 범위를 벗어나면 작동하지 않음 -> 지역변수(물론 밖에서 사용된 건 전역변수)
- let은 값의 재 할당이 가능하며 const는 상수이기에 재할당이 불가능
2) Arrow function 추가
- 기존에 function 함수명(a, b) {
return a+b
} 이라는 구조에서
함수명 = (a, b) => a+b 라는 간결한 구조로 바뀜, 가독성 상승
- 기존 함수와 this에 대한 바인딩이 다르다고 함
3) Template literal
- 문자열을 백틱(`)으로 감쌀 수 있음
- 백틱으로 감싸진 문자열에 ${변수}를 넣어 동적으로 활용 가능
4) 모듈화
- es6부터는 js파일들을 나누어 따로 저장하고 import/export를 통해 불러오거나 내보낼 수 있게됨
5) class
- class라는 키워드를 사용할 수 있다.
6) destructuring assignment
- 객체나 배열의 구조를 분해하여 간결하게 작성할 수 있도록 해준다.
객체 분해 예시
let options = { title: "Menu" // 기존 방식 }; let {width = 100, height = 200, title} = options; // 구조분해 할당, 프로퍼티가 없는 경우 // 기본 값을 이렇게 설정해줄 수도 있다. alert(title); // Menu alert(width); // 100 alert(height); // 200
출처: https://ko.javascript.info/destructuring-assignment#ref-657
7) 프로미스 메서드 도입
- 위의 Promise부분 참조 바람
8) string 데이터의 메서드 추가 (includes, startWith, endWith)
- 특정 문자열이 포함되어 있는지, 특정 문자열로 시작하는지, 끝나는지를 검토해 true or false를 반환함.
▶ 공부 시 참고 링크들
https://hbsowo58.tistory.com/407
'항해 99' 카테고리의 다른 글
항해 99 5기 TIL_16 (0) 2022.01.26 항해 99 5기 TIL_15 (0) 2022.01.25 항해 99 5기 TIL_14 (0) 2022.01.23 항해 99 5기 TIL_13 (0) 2022.01.22 항해 99 5기 TIL_12 (0) 2022.01.22