const express = require('express');const app = express();let posts = []; // 게시글을 리스트로 사용할 posts에 빈 리스트 할당// req.body를 사용하려면 JSON 미들웨어를 사용해야 합니다.// 사용하지 않으면 undefined로 반환app.use(express.json()); // JSON 미들웨어 활성화// POST 요청 시 컨텐트 타입이 application/x-www-form-urlencoded인 경우 파싱app.use(express.urlencoded({ extended: true }); // JSON 미들웨어와 함께 사용app.get('/', (req, res) => { // /로 요청이 오면 실행 res.json(post) ..
1. 3번째 라인의 Lee를 왜 저렇게 쓰는지 모르겠습니다.const person = (name => ({ sayHi() {return `hi my name is $name`;}}))('Lee');console.log(person.sayHi()) // hi my name is Lee. 2. 함수에 나오는 this가 뭘 가리키는지 이해가 가지 않습니다. class Base { constructor(name) { this.name = name; } sayHi() { return `hi ${this.name}`; }}class Derived extends Base { // 화살표 함수의 super는 상위 스코프인 constructor의 super을 가리킨다. sayHi ..