Skip to content

[4주차/찬찬] 워크북 제출합니다.#12

Open
inhadissolve wants to merge 2 commits intoUMC-Inha:chanchan/mainfrom
inhadissolve:main
Open

[4주차/찬찬] 워크북 제출합니다.#12
inhadissolve wants to merge 2 commits intoUMC-Inha:chanchan/mainfrom
inhadissolve:main

Conversation

@inhadissolve
Copy link
Copy Markdown

✅ 워크북 체크리스트

  • [✅ ] 모든 핵심 키워드 정리를 마쳤나요?
  • [✅ ] 핵심 키워드에 대해 완벽히 이해하셨나요?
  • [✅ ] 이론 학습 이후 직접 실습을 해보는 시간을 가졌나요?
  • [✅ ] 미션을 수행하셨나요?
  • [✅ ] 미션을 기록하셨나요?

✅ 컨벤션 체크리스트

  • [✅ ] 디렉토리 구조 컨벤션을 잘 지켰나요?
  • [✅ ] pr 제목을 컨벤션에 맞게 작성하였나요?
  • [✅ ] pr에 해당되는 이슈를 연결하였나요?(중요)
  • [✅ ] 적절한 라벨을 설정하였나요?
  • [✅ ] 파트장에게 code review를 요청하기 위해 reviewer를 등록하였나요?
  • [✅ ] 닉네임/main 브랜치의 최신 상태를 반영하고 있는지 확인했나요?(매우 중요!)

@inhadissolve inhadissolve requested a review from seoki180 April 7, 2026 16:14
@inhadissolve inhadissolve self-assigned this Apr 7, 2026
@inhadissolve inhadissolve added keyword 키워드 수행 라벨입니다 mission 미션수행 라벨입니다 week4 labels Apr 7, 2026

CommonJS는 기본적으로 동기적으로 모듈을 불러오고,

ESM은 더 현대적인 모듈 시스템으로 비동기적 처리와 정적 분석에 더 유리하다.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞습니다! ESM은 로딩 파이프라인 자체가 비동기라 top-level await을 통해 비동기 함수를 기다려서 실행시점에 항상 동작이 초기화되었음을 보장 할 수 있습니다!

Comment on lines +86 to +96
### var

예전 방식이고, 호이스팅과 스코프 문제 때문에 지금은 사용을 지양하는 편이다.

### 내가 느낀 점

무조건 `let`을 쓰는 것보다,

“안 바뀌는 값은 const, 바뀌는 값만 let”

이 기준으로 코드를 쓰는 게 더 명확하다고 느꼈다.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var 이 사장된이유를 호이스팅을 기준으로 찾아보시면 좋습니다!
var - let,const 모두 호이스팅이 일어납니다! 하지만 let, const는 값 할당 전에 TDZ에 메모리가 올라가 접근시 Reference error를 발생하게 되죠! error가 발생해 프로세스가 멈추는것과 undefined값이 실제로 출력되는것에 차이를 이해해보시면 좋을거 같아요


자바스크립트는 단일 스레드로 작동하기 때문에, 오래 걸리는 작업은 비동기로 처리하는 것이 중요하다.

`async / await`은 비동기 코드를 동기 코드처럼 읽기 쉽게 만들어준다.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async-await으로 비동기를 쉽게 처리할수 있습니다!

그럼 예전 Nodejs환경에서는 어땠을까요?
Node가 처음 나왔을때는 모든 비동기 처리를 callback함수로 처리했습니다 함수안에 함수를 넣고 함수안에 넣고,,, 이걸 무한 반복했죠

이후 ES6에서 Promise 문법이 나오고 .then문법으로 처리 할 수 있었습니다. 물론 콜백보단 낫지만 그래도 읽기 어렵고 콜백 흐름을 찾기 어려웠죠,

그리고 ES2017에 async/await이 나왔는데 같은 코드를 각자 방법으로 구현한걸 비교해보는것도 좋을거 같아요!


중간 값이 없으면 에러 대신 `undefined`를 반환한다.

### nullish 병합 연산자 `??`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullish는 두가지 방법이 있는데 || 과 ??가 있습니다.

||는 falsy한 값(0,"", false, null, undefined}일때 값이 우측으로 넘어가고

??는 null undefined만 우측으로 넘어갑니다

- Node.js는 서버 자체가 아니라 JavaScript 런타임이다.
- 즉, 브라우저 밖에서도 JavaScript를 실행할 수 있게 해주는 환경이다.
- Node.js는 싱글 스레드 기반이지만, 논블로킹 I/O와 이벤트 루프 구조 덕분에 많은 요청을 효율적으로 처리할 수 있다.
- 파일 시스템, 네트워크, 데이터베이스처럼 I/O 중심 작업에 강점이 있다
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

두가지 구조 덕분에 spring과는 다르게 IO에 강점이 있는 기술이 바로 Node.js 입니다!

spring은 멀티스레딩으로 빠른 연산이 가능하고
node.js는 싱글스레드라 가볍지만 이벤트루프 구조 덕에 IO작업에 강점이 있죠


## 6. 환경 변수와 보안

이번 주차에서는 `.env` 파일과 `.gitignore` 설정도 같이 확인했다.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

두가지 정말 중요합니다. vscode 설정중에 .env나 .gitignore에 파일을 올리면 해당파일이 회색으로 보이게 하는 설정도 있으니 찾아보시면 편할거에요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keyword 키워드 수행 라벨입니다 mission 미션수행 라벨입니다 week4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants