๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

ยท ์•ฝ 6๋ถ„

Strict Mode#

  • ES5 ๋ถ€ํ„ฐ ์ง€์›

  • ์ „์—ญ ๋˜๋Š” ํ•จ์ˆ˜ body์˜ ์„ ๋‘์— use strict ์ถ”๊ฐ€

  • ์•”๋ฌต์  ์ „์—ญ ๋ณ€์ˆ˜ ๋ฐฉ์ง€

  • ๋ณ€์ˆ˜, ํ•จ์ˆ˜, ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ์‚ญ์ œ ๋ฐฉ์ง€

    function foo(a) {    'use strict';
        delete a;    // SyntaxError: Delete of an unqualified identifier in strict mode.}
  • ๋งค๊ฐœ๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ์ค‘๋ณต ๋ฐฉ์ง€

  • with ๋ฌธ์˜ ์‚ฌ์šฉ

  • ์ผ๋ฐ˜ ํ•จ์ˆ˜์˜ this ์— undefined ๋ฐ”์ธ๋”ฉ

    'use strict';
    function foo() {    console.log(this);}
    foo(); // undefined
    function foo() {    console.log(this);}
    foo(); // Window

DOCTYPE#

Document Type์˜ ์•ฝ์ž๋กœ ๋ฌธ์„œ๊ฐ€ ์–ด๋–ค ๋ฒ„์ „์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ๋Š”์ง€ ๋ฏธ๋ฆฌ ์„ ์–ธํ•˜์—ฌ ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋‚ด์šฉ์„ ์˜ฌ๋ฐ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ๊ฒƒ์ด๋‹ค.

โ˜ DOCTYPE ์€ ๋ ˆ๊ฑฐ์‹œํ•œ ์ด์œ ๋กœ ํ•„์š”ํ•˜๋‹ค. ์ƒ๋žตํ•˜๋ฉด ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋ฌธ์„œ๋ฅผ quirks mode(ํ˜ธํ™˜ ๋ชจ๋“œ) ๋กœ ๋ Œ๋”๋งํ•˜๊ณ , ํฌํ•จํ•˜๋ฉด ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋ฌธ์„œ๋ฅผ no-quirks-mode(๋˜๋Š” standard mode) ๋กœ ๋ Œ๋”๋ง ํ•œ๋‹ค.

quirks mode vs standard mode#

quirks mode#

  • ์˜ค๋ž˜๋œ ๋ฌธ์„œ๊ฐ€ ์ตœ์‹  ๋ธŒ๋ผ์šฐ์ €์—์„œ "๋น„ํ‘œ์ค€ ๋ชจ๋“œ"(๊ณผ๊ฑฐ Navigator 4 or IE 5)๋ฅผ ์ ์šฉํ•ด์„œ ๋™์ž‘ํ•œ๋‹ค.

  • ์ตœ์‹  ๋ธŒ๋ผ์šฐ์ €์—์„œ ๊นจ์ง€์ง€ ์•Š๊ณ  ๋ณด์—ฌ์ง€๊ฒŒ ๋˜์ง€๋งŒ, ๋ธŒ๋ผ์šฐ์ € ๋ณ„๋กœ ๋‹ค๋ฅด๊ฒŒ ๋ณด์—ฌ์ง€๊ฒŒ๋œ๋‹ค.

standard mode#

  • ํ‘œ์ค€ HTML, CSS๋ฅผ ์ ์šฉํ•˜์—ฌ ๋ Œ๋”๋งํ•œ๋‹ค.

DTD (Document Type Definition)#

๋ฌธ์„œ ํ˜•์‹์„ ์ •์˜ํ•œ ๊ฒƒ์œผ๋กœ DOCTYPE ์„ ๋ช…์‹œํ•  ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. DTD ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒƒ๋“ค์ด ์žˆ๋‹ค. ๋ชจ๋“  ํƒ€์ž…์˜ ํŠน์„ฑ์„ ๋‹ค ํŒŒ์•…ํ•˜๋Š” ๊ฒƒ์€ ๋ฌด๋ฆฌ๊ฐ€ ์žˆ์„ ๊ฒƒ ๊ฐ™๊ณ , ํ˜„์žฌ ์‹œ์ ์—์„œ HTML5 ๋ฌธ์„œ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด <!DOCTYPE html> ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ตœ์„ ์ด๋‹ค.

  • XHTML 1.1

  • XHTML 1.0

    • Strict DTD

    • Transitional DTD

    • Frameset DTD

  • HTML 4.01

    • Strict DTD

    • Transitional DTD

    • Frameset DTD

  • HTML 5

ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง•#

๋ฐ”๋ฒจ#

  • ๋ฐ”๋ฒจ์€ ํ˜„์žฌ ๋ฐ ์ด์ „ ๋ธŒ๋ผ์šฐ์ € ๋˜๋Š” ํ™˜๊ฒฝ์—์„œ ES6 ์ด์ƒ์˜ ์ฝ”๋“œ๋ฅผ ์ด์ „ ๋ฒ„์ „๊ณผ ํ˜ธํ™˜๋˜๋Š” JavaScript ๋ฒ„์ „์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋„๊ตฌ ๋ชจ์Œ(toolchain)์ด๋‹ค.

  • ๋ฐ”๋ฒจ์€ ์„ธ ๋‹จ๊ณ„๋กœ ๋นŒ๋“œ๋ฅผ ์ง„ํ–‰ํ•œ๋‹ค.

    1. ํŒŒ์‹ฑ (Parsing) : ์ฝ”๋“œ๋ฅผ ์ฝ๊ณ  ์ถ”์ƒ ๊ตฌ๋ฌธํŠธ๋ฆฌ(AST)๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋‹จ๊ณ„

    2. ๋ณ€ํ™˜ (Transforming) : ๋ฐ”๋ฒจ ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์ถ”์ƒ ๊ตฌ๋ฌธ ํŠธ๋ฆฌ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๋‹จ๊ณ„

    3. ์ถœ๋ ฅ (Printing) : ๋ณ€๊ฒฝ๋œ ๊ฒฐ๊ณผ๋ฌผ์„ ์ถœ๋ ฅํ•˜๋Š” ๋‹จ๊ณ„

  • ์ปดํŒŒ์ผ๋Ÿฌ๋กœ์จ ๋ฐ”๋ฒจ ํ”Œ๋Ÿฌ๊ทธ์ธ(๊ตฌ๋ฌธ ๋ณ€ํ˜•)๊ณผ ํด๋ฆฌํ•„์ด ํ•˜๋Š” ์ผ(๋‚ด์žฅ๋œ ํ•จ์ˆ˜/๊ฐ์ฒด ๊ตฌํ˜„ )์„ ๊ตฌ๋ถ„ํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค.

    • ํ™”์‚ดํ‘œ ํ•จ์ˆ˜

      ๊ตฌ๋ฌธ ๋ณ€ํ˜•์œผ๋กœ ์ด์ „ ๋ฒ„์ „์˜ ์ฝ”๋“œ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.

      // ์ปดํŒŒ์ผ ์ „const sum = (a, b) => a + b;
      // ์ปดํŒŒ์ผ ํ›„'use strict';
      var sum = function sum(a, b) {    return a + b;};
    • Promise

      Promise ๋Š” ES6์—์„œ ์ถ”๊ฐ€๋œ ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(standard built-in object)์ด๋‹ค. ๋”ฐ๋ผ์„œ ๊ตฌ๋ฌธ ๋ณ€ํ˜•์œผ๋กœ ์ด์ „ ๋ฒ„์ „์˜ ์ฝ”๋“œ๋กœ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ์ด๋ฅผ ์œ„ํ•œ ํด๋ฆฌํ•„์„ ์ถ”๊ฐ€ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

  • ๋ฐ”๋ฒจ์˜ useBuiltIns ์˜ต์…˜

    • ๊ธฐ๋ณธ์ ์œผ๋กœ import 'core-js' ๋Š” core-js ์˜ ๋ชจ๋“  ํด๋ฆฌํ•„ ๊ฐ€์ ธ์˜ด

    • useBuiltIns: entry ์˜ต์…˜์„ ์ฃผ๋ฉด import 'core-js' ์—์„œ "๋Œ€์ƒ ๋ธŒ๋ผ์šฐ์ €์— ํ•„์š”ํ•œ" ํด๋ฆฌํ•„์„ ๋ชจ๋‘ ๊ฐ€์ ธ์˜ด

    • useBuiltIns: usage ์˜ต์…˜์„ ์ฃผ๋ฉด import ๋ฅผ ํ•˜์ง€ ์•Š์•„๋„ ์ฝ”๋“œ๋ฅผ ์ •์  ๋ถ„์„ํ•˜์—ฌ, ์ฝ”๋“œ์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ํด๋ฆฌํ•„๋งŒ ๊ฐ€์ ธ์˜จ๋‹ค.

      • ์ง€์›ํ•˜๋ ค๋Š” "๋ธŒ๋ผ์šฐ์ € ๋งˆ๋‹ค" ํ•„์š”ํ•œ ํด๋ฆฌํ•„๋งŒ import ํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋Š”๊ฐ€? ex) ie, chrome์ด ํƒ€๊ฒŸ์ธ ๊ฒฝ์šฐ promise๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, promise ํด๋ฆฌํ•„์„ import ํ•ด์•ผํ•˜์ง€๋งŒ, ์ด๋Š” chrome์—๊ฒŒ๋Š” ๋ถˆํ•„์š”ํ•˜๋‹ค.

      • ๋ฒˆ๋“ค์— ํฌํ•จ์‹œํ‚ค๋Š” ๊ฒƒ๊นŒ์ง€ ์ตœ์ ํ™” ํ•˜๋ ค๋ฉด ๋Ÿฐํƒ€์ž„ ๊ฒ€์‚ฌ๊ธฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ User-agent ๊ธฐ๋ฐ˜ ๊ฐ์ง€๋ฅผ ํ•ด์•ผ ๋˜๋Š”๋ฐ, ์ด๋Š” ๋ฆฌ์†Œ์Šค๋ž‘ ์‹œ๊ฐ„์ด ๋งŽ์ด ๋“ ๋‹ค.

        zloirock/core-js

        [Feature Request] Polyfill using dynamic import. ยท Issue #518 ยท zloirock/core-js

      • module , nomodule ์˜ ์ง€์› ์—ฌ๋ถ€์— ๋”ฐ๋ผ ๋ฒˆ๋“ค๋ง์„ ๋‚˜๋ˆ  ์ตœ์ ํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„์žˆ๋‹ค.

        Serve modern code to modern browsers for faster page loads


ยท ์•ฝ 4๋ถ„

์ผ๋ฐ˜ ํ•จ์ˆ˜ vs ํ™”์‚ดํ‘œ ํ•จ์ˆ˜#

const shape = {    radius: 10,    diameter() {        return this.radius * 2;    },    arrowDiameter: () => {        return this.radius * 2;    },};
console.log(shape.diameter());// 20console.log(shape.arrowDiameter());// NaN
const diameter = shape.diameter;const arrowDiameter = shape.arrowDiameter;
console.log(diameter());// NaNconsole.log(arrowDiameter());// NaN
function Shape() {    this.radius = 10;    this.diameter = function () {        return this.radius * 2;    };    this.arrowDiameter = () => {        return this.radius * 2;    };}
const shape = new Shape();
console.log(shape.diameter());// 20console.log(shape.arrowDiameter());// 20
const diameter = shape.diameter;const arrowDiameter = shape.arrowDiameter;
console.log(diameter());// NaNconsole.log(arrowDiameter());// 20
  • ์ผ๋ฐ˜ ํ•จ์ˆ˜๋Š” ํ˜ธ์ถœํ•  ๋•Œ ๋™์ ์œผ๋กœ this ๋ฅผ ๋ฐ”์ธ๋”ฉํ•œ๋‹ค.

  • ํ™”์‚ดํ‘œ ํ•จ์ˆ˜๋Š” ์„ ์–ธํ•  ๋•Œ ์ •์ ์œผ๋กœ this ๋ฅผ ๋ฐ”์ธ๋”ฉํ•œ๋‹ค. (์–ธ์ œ๋‚˜ ์ƒ์œ„ ์Šค์ฝ”ํ”„์˜ this ๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค.)

  • ์ผ๋ฐ˜ ํ•จ์ˆ˜๋Š” prototype ํ”„๋กœํผํ‹ฐ๋ฅผ ๊ฐ€์ง„๋‹ค. โ‡’ constructor ํ•จ์ˆ˜๋กœ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค.

  • ํ™”์‚ดํ‘œ ํ•จ์ˆ˜๋Š” prototype ํ”„๋กœํผํ‹ฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š๋‹ค. โ‡’ constructor ํ•จ์ˆ˜๋กœ์‚ฌ์šฉ๋  ์ˆ˜ ์—†๋‹ค.


์ƒ์„ฑ์ž ํ•จ์ˆ˜(constructor)์™€ ํ”„๋กœํ† ํƒ€์ž…(prototype)#

function Person(name, age) {    this.name = name;    this.age = age;}
// Person.prototype = { constructor: function Person(...) { ... } }// Person.prototype.constructor = function Person(...) { ... }
const foo = new Person('foo', 30);// foo: Person { name: 'foo', age: 30 }// foo.__proto__: { constructor: function Person(...) { ... } }// foo.__proto__.constructor = function Person(...) { ... }

2020-11-06-201106-image-0


2020-11-06-201106-image-1

โ˜ __proto__ ๋Š” ECMAScript์˜ ์ŠคํŽ™์ด ์•„๋‹Œ ์ผ๋ถ€ ๋ชจ๋˜ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ตฌํ˜„ํ•œ ๊ฒƒ์œผ๋กœ, [[Prototype]] ๋ฅผ ์ ‘๊ทผํ•˜๋Š” ์†์„ฑ์ด๋‹ค.

function Person(name) {    this.name = name;    this.getName = function () {        return this.name;    };}
console.log(Person.prototype); // { constructor: function Person(name) { ... } }
function Child(name, age) {    Person.call(this, name);    this.age = age;    this.getAge = function () {        return this.age;    };}
console.log(Child.prototype); // { constructor: function Child(name, age) { ... } }
Child.prototype = Object.create(Person.prototype);
console.log(Object.create(Person.prototype)); // Person {}console.log(Child.prototype); // Person {}console.log(Child.prototype.constructor); // function Person(name) { ... }
Child.prototype.constructor = Child;
console.log(Child.prototype);// Person { constructor: function Child(name, age) { ... } }
var child = new Child('foo', 20);
console.log(child.getName()); // 'foo'console.log(child.getAge()); // 20

ํด๋ž˜์Šค ๋ฌธ๋ฒ•์€ ๋‹จ์ง€ "๊ตฌ๋ฌธ์  ์„คํƒ•" ์ธ๊ฐ€?#

class User {    constructor(name) {        this.name = name;    }
    sayHi() {        alert(this.name);    }}
let user = new User('John');user.sayHi();
function User(name) {    this.name = name;}
User.prototype.sayHi = function () {    alert(this.name);};
let user = new User('John');user.sayHi();

ES6์˜ ํด๋ž˜์Šค ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๊ณผ ์ผ์น˜ํ•œ ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ์กด function + prototype ๋ฌธ๋ฒ•์˜ ์กฐํ•ฉ์œผ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ถ€ ์‚ฌ๋žŒ๋“ค์€ ๋‹จ์ง€ ํด๋ž˜์Šค ๋ฌธ๋ฒ•์„ "๊ตฌ๋ฌธ์  ์„คํƒ•" (syntax sugar)๋ผ๊ณ  ๋งํ•œ๋‹ค.

ํ•˜์ง€๋งŒ ๋ช‡ ๊ฐ€์ง€ ์ค‘์š”ํ•œ ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค.

  1. class ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•ด์„œ ๋งŒ๋“  ํ•จ์ˆ˜์—” ํŠน์ˆ˜ ๋‚ด๋ถ€ ํ”„๋กœํผํ‹ฐ์ธ [[FunctionKind]]: "classConstructor" ๊ฐ€ ์ด๋ฆ„ํ‘œ์ฒ˜๋Ÿผ ๋ถ™์–ด์„œ, ์ด ํด๋ž˜์Šค ์ƒ์„ฑ์ž๋ฅผ new ์™€ ํ•จ๊ป˜ ํ˜ธ์ถœํ•˜์ง€ ์•Š์œผ๋ฉด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

  2. ํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๋Š” non-enumerable ๋กœ, for ... in ๊ตฌ๋ฌธ ๋“ฑ์˜ ๊ฐ์ฒด ์ˆœํšŒ์—์„œ๋ฉ”์†Œ๋“œ๋Š” ์ˆœํšŒํ•˜์ง€ ์•Š๋Š”๋‹ค. (enumerable ํ”Œ๋ž˜๊ทธ๊ฐ€ false ์ด๋‹ค.)

  3. ํด๋ž˜์Šค๋Š” ํ•ญ์ƒ use strict ๋ชจ๋“œ์ด๋‹ค.

  4. ์ด์™ธ์—๋„ getter, setter, ๋ฏน์Šค์ธ ๋“ฑ์˜ ๊ธฐ๋Šฅ์ด ์žˆ๋‹ค.

ํด๋ž˜์Šค์™€ ํ•จ์ˆ˜์—์„œ์˜ new ์—ฐ์‚ฐ์ž ๋™์ž‘#

2020-11-06-201106-image-2

ยท ์•ฝ 1๋ถ„

๊ฐ€์ƒ ํ™˜๊ฒฝ ์ƒ์„ฑ#

python3 -m venv .venv

๊ฐ€์ƒ ํ™˜๊ฒฝ ํ™œ์„ฑํ™”#

source .venv/bin/activate

ํ™•์ธํ•˜๊ธฐ#

which python

์ฐธ๊ณ ์ž๋ฃŒ#

ํŒŒ์ด์ฌ์—์„œ venv๋กœ ๊ฐ€์ƒ ํ™˜๊ฒฝ ์‚ฌ์šฉํ•˜๊ธฐ

ยท ์•ฝ 1๋ถ„

1. ํ˜„์žฅ ์ดํ•ดํ•˜๊ณ  ๋Œ€์‘ํ•˜๊ธฐ#

2. ํ”„๋กœ์ ํŠธ๋ฅผ ํ†ตํ•ด์„œ JS์ตํžˆ๊ธฐ#

3. ํ–ฅ์ƒ๋œ UX๋ฅผ ๋ชฉํ‘œ๋กœ ๊ฐœ๋ฐœํ•˜๊ธฐ#

4. ํ•จ๊ป˜ ์ž๋ผ๊ธฐ#

  • ํ•จ๊ป˜ ํ•™์Šตํ•˜๊ธฐ

  • ๊ฐ„๋‹จํ•œ ํ”„๋กœ์ ํŠธ ํ•จ๊ป˜ ๋งŒ๋“ค์–ด๋ณด๊ธฐ

  • ํ”ผ๋“œ๋ฐฑ

  • ํ”ผ๊ณคํ•˜์ง€๋งŒ ํ•จ๊ป˜ ๋งž์ถฐ๋ณต

  • ์—…๋ฌด๋ฅผ ๋ถ„์„ํ•˜๊ณ  github issue/project๋กœ ์ผ๊ฐ ๋งŒ๋“ค์–ด์„œ ๊ด€๋ฆฌํ•˜๊ธฐ

  • PR ๋ณด๋‚ด๊ธฐ

  • ์ฝ”๋“œ๋ฆฌ๋ทฐ ํ•˜๊ธฐ

  • git branch ์ „๋žต์„ธ์›Œ๋ณด๊ธฐ

5. ๊ธฐ์ดˆ๋Š” ํŠผํŠผํ•˜๊ฒŒ#

  • ์ง€์†๊ฐ€๋Šฅํ•œ ๊ณต๋ถ€

  • TCP/IP๋ฅผ ํฌํ•จํ•œ HTTP ์ค‘์‹ฌ ๋„คํŠธ์›Œํฌ ๊ณต๋ถ€

  • ๋ฐฑ์—”๋“œ ์ ‘ํ•ด๋ณด๊ธฐ

6. HTML CSS์—์„œ FE์—”์ง€๋‹ˆ์–ด๋กœ#

ยท ์•ฝ 2๋ถ„

CSS#

  • @import : ๋‹ค๋ฅธ ์Šคํƒ€์ผ ์‹œํŠธ์—์„œ ์Šคํƒ€์ผ ๊ทœ์น™์„ ๊ฐ€์ ธ์˜ด

  • ์‚ฌ์šฉ์ž ์ง€์ • CSS ์†์„ฑ(CSS ๋ณ€์ˆ˜, ์ข…์† ๋ณ€์ˆ˜)

    • ์„ ์–ธ
    element {    --main-bg-color: brown;}
    • ์‚ฌ์šฉ
    element {    background-color: var(--main-bg-color);}

ํ•˜์œ„ ํ˜ธํ™˜์„ฑ ๋ฐ ํ”„๋ก ํŠธ์—”๋“œ ๋นŒ๋“œ#

Can I use... Support tables for HTML5, CSS3, etc

ECMAScript 6 compatibility table

  • transpilling์„ ํ†ตํ•ด์„œ ํ•˜์œ„ ๋ธŒ๋ผ์šฐ์ €์—์„œ๋„ ๋™์ž‘ํ•˜๊ฒŒ ๋ฌธ๋ฒ•์„ ๋ฐ”๊พผ๋‹ค.

  • polyfill์„ ํ†ตํ•ด์„œ ์ง€์›ํ•˜์ง€ ์•Š๋Š” native API๋ฅผ ๋‹ค๋ฅธ ์ฝ”๋“œ๋กœ ๋™์ž‘ํ•˜๊ฒŒ ํ•œ๋‹ค.


  • npm init -y : npm init -โ€”yes ๋กœ npm init ์‹œ์— ๋‚˜์˜ค๋Š” ์„ค์ •์— ๋ชจ๋‘ yes๋กœ์ƒ๋žตํ•˜์—ฌ ์ง„ํ–‰ํ•จ

  • --save-devย is used to save the package for development purpose. Example: unit tests, minification..

  • --saveย is used to save the package required for the application to run.

babel#

ํ•˜์œ„ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ง€์›๊ฐ€๋Šฅํ•˜๋„๋ก transpiling

Webpack#

๋ชจ๋“ˆ ๋ฒˆ๋“ค๋Ÿฌ


JavaScript modules


var path = require('path');
module.exports = {    mode: 'none',    entry: './index.js',    output: {        filename: 'bundle.js',        path: path.resolve(__dirname, 'dist'),    },    module: {        rules: [            {                test: /\.css$/,                use: ['style-loader', 'css-loader'],            },        ],    },};
  • mode : development, production, none ๋ชจ๋“œ ์ค‘ ์„ค์ •

  • entry : ์‹œ์ž‘์ 

  • output : ๊ฒฐ๊ณผ๋ฌผ

  • module : ๋กœ๋”


DOM#

ยท ์•ฝ 2๋ถ„

HTTP#

HyperText Transfer Protocol


2020-07-11-200711-image-0


2020-07-11-200711-image-1

ํด๋ผ์ด์–ธํŠธ๋Š” ์„œ๋ฒ„์—๊ฒŒ HTML ํŒŒ์ผ์„ ์š”์ฒญ(Request), ์„œ๋ฒ„๋Š” ์‘๋‹ต(Response)

Request Message#

  • GET /1.html HTTP/1.1 => ์š”์ฒญํ–‰

  • Host: localhost:8080 => ๋„คํŠธ์›Œํฌ์˜ ์ปดํ“จํ„ฐ ์‹๋ณ„ํ•˜๋Š” ์ด๋ฆ„

  • User-Agent : ... => ์œ ์ € ์ปดํ“จํ„ฐ, ์›น๋ธŒ๋ผ์šฐ์ € ์ •๋ณด

  • Accept-Encoding : gzip, deflate, br => ๋ฐ์ดํ„ฐ ์–‘์ด ๋งŽ์œผ๋ฉด ์••์ถ•ํ•ด์„œ ์ „์†กํ•˜๋Š”๋ฐ, ์–ด๋–ค ์••์ถ•๋ฐฉ์‹์„ ์ง€์›ํ•˜๋Š”์ง€ ์„ค๋ช…

  • If-Modified-Since: => ๋งˆ์ง€๋ง‰์œผ๋กœ ํŽ˜์ด์ง€๋ฅผ ๋‹ค์šด๋ฐ›์€๊ฒŒ ์–ธ์ œ์ธ์ง€ ํ™•์ธํ•˜์—ฌ ๋‹ค์‹œ ๋‹ค์šด๋ฐ›์„์ง€ ๊ฒฐ์ •

  • <blank line> => ๋ธ”๋žญํฌ๋กœ ํ—ค๋”์™€ ๋ฐ”๋”” ๊ตฌ๋ถ„

  • Request Message Body

Response Message#

2020-07-11-200711-image-2

  • status : ์„œ๋ฒ„์˜ ์‘๋‹ต ๊ฒฐ๊ณผ๋ฅผ ์•Œ๋ ค์คŒ.


๊ทธ ์™ธ#

  • HTTPS, SSL

  • Cache

  • cookie

  • web storage

  • proxy

ยท ์•ฝ 4๋ถ„

์ฝ”๋“œ๋ฆฌ๋ทฐ#

node ๋กœ ๋ฐฑ์—”๋“œ๋ฅผ ํ•˜๋‹ค๋ณด๋ฉด shared ํด๋”๋ฅผ ๋งŒ๋“ค๊ณ  ํ™˜๊ฒฝ์„ ์ž˜ ๊ฐ–์ถ”๊ณ  ๋ฐฑ๊ณผ ํ”„๋ก ํŠธ๊ฐ€ ๊ณต์œ ํ•˜๊ธฐ๋„ ํ•œ๋‹ค.


  • HTML์€ ๊ตฌ์กฐ

    • p ํƒœ๊ทธ๋ฅผ ์“ธ ๋•Œ๋Š” paragraph์ธ์ง€

    • ๊ธ€์ž๋ฅผ ํฌ๊ฒŒํ•˜์ž ํ•˜๊ณ  h3๋ฅผ ์“ฐ๋ฉด ์•ˆ๋œ๋‹ค.

    • list ํƒœ๊ทธ โ†’ ๋‹ค์Œ ํ™ˆํŽ˜์ด์ง€์˜ ๋‰ด์Šค ๋ฆฌ์ŠคํŠธ

  • CSS๋Š” ์Šคํƒ€์ผ

ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ#


CSS, JS๋ฅผ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒฝํ–ฅ

ํ˜„๋Œ€์˜ ํ”„๋ ˆ์ž„์›Œํฌ๋Š” ์ปดํฌ๋„ŒํŠธ ๋ณ„๋กœ, ๋‹ค๋ฅธ ๋ฐฉ์‹์œผ๋กœ ๋ชจ์œผ๊ธฐ๋„ ํ•จ.

๊ฐœ๋ฐœํ•  ๋• ํ•ญ์ƒ ๋‚˜๋ˆ ์„œ

์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ํ•ญ์ƒ ๋ณ€๊ฒฝ๋œ๋‹ค๋Š” ๊ฐ€์ •์„ ํ•˜๊ณ  ๊ฐœ๋ฐœํ•˜๋ผ. ์„œ๋น„์Šค ์ฝ”๋“œ๊ฐ€ ๋ณ€๊ฒฝ์ด ๋œ๋‹ค.

์ข‹์€ ์ฝ”๋“œ๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•, ๋ณ€๊ฒฝ์ด ์šฉ์ดํ•œ ์ฝ”๋“œ. ๋ณ€๊ฒฝ์„ ํ–ˆ์„ ๋•Œ ๋‹ค๋ฅธ ์ฝ”๋“œ์— ์˜ํ–ฅ์„์ฃผ์ง€ ์•Š๋Š” ์ฝ”๋“œ

๋ณ€๊ฒฝ๋  ๋•Œ ์˜ํ–ฅ์„ ๋œ ์ฃผ๊ณ  ์ˆ˜์ •๋„ ์‰ฝ๊ฒŒ ๋˜๊ณ  ๊ธฐ๋Šฅ๋„ ์ถ”๊ฐ€๋˜๊ณ  ...

๋‚˜๋ˆ ์„œ ์—ญํ• ๋ณ„๋กœ

CSS ๊ณตํ†ต ๋ถ€๋ถ„ > Global, common ...

๋ชจ๋“  ๋ฆฌํŒฉํ† ๋ง์€ ์ค‘๋ณต๋ถ€ํ„ฐ

  • JS ํŒŒ์ผ ์ž์ฒด๋Š” ๋ชจ๋“ˆ์ด๊ธฐ ๋•Œ๋ฌธ์—, is ๋“ฑ์ด ๋“ค์–ด๊ฐ€๋ฉด ์–ด์ƒ‰ํ•ด๋ณด์ผ ์ˆ˜ ์žˆ๋‹ค.

๋งค์ง๋„˜๋ฒ„๋ฅผ ์—†์• ๋ผ - ์ฝ”๋“œ์—์„œ ์ˆซ์ž, ๋ฌธ์ž์—ด์„ ์“ธ ๋•Œ ๋ถ„๋ฆฌํ•ด๋ผ.

JS์—์„œ CSS๋ฅผ ์กฐ์ž‘ํ•  ์ผ์ด ์žˆ์„ ๋•Œ โ†’ classList์— remove, add, toggle ๋“ฑ์œผ๋กœ ์กฐ์ž‘ํ•œ๋‹ค. ์Šคํƒ€์ผ์„ ์ง์ ‘ ์กฐ์ž‘ํ•˜์ง€ ์•Š์Œ.

  • ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ฝ”๋“œ

  • ๊ฐ€๋…์„ฑ์ด ์ข‹์€ ์ฝ”๋“œ

  • ํ…Œ์ŠคํŠธ๊ฐ€ ์‰ฌ์šด ์ฝ”๋“œ

  • ์—ญํ• ์ด ๋ช…ํ™•ํ•œ ํ•จ์ˆ˜

  • ์ ‘๊ทผํ•  ์ผ์ด ๋งŽ์œผ๋ฉด ๋ณ€์ˆ˜์— ๋‹ด์•„์„œ

  • ์ด๋ฒคํŠธ๋ฅผ ์–ด๋””์„œ ๋“ฑ๋กํ•ด์•ผ ํ• ๊นŒ?

  • ์กฐ๊ฑด๋„ ํ•จ์ˆ˜๋กœ ๋‚˜๋ˆ ๋ผ


์บ ํ”„์˜ ๋ชฉ์ #


  • ์–ด๋–ป๊ฒŒ ๋ชจ๋“ˆํ™”๋ฅผ ์ž˜ํ• ๊นŒ

  • ์–ด๋–ป๊ฒŒ ๋ณ€๊ฒฝ์ด ์šฉ์ดํ•œ ์ฝ”๋“œ๋ฅผ ๋งŒ๋“ค๊นŒ

  • ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์จ๋„ ๋ชจ๋“ˆํ™”๊ฐ€ ์ž๋™์œผ๋กœ ๋˜๋Š”๊ฒŒ ์•„๋‹ˆ๋‹ค

๋ณ€์ˆ˜๋ช…#

  • ์˜คํ”ˆ์†Œ์Šค๋ฅผ ์ž์ฃผ ๋ณด๋ฉด ๋„์›€์ด ๋œ๋‹ค.

  • ์ข‹์€ ํšŒ์‚ฌ๋ฉด ๋™์ž‘ํ•˜๋Š” ์„œ๋น„์Šค ์†Œ์Šค๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค


๋‚˜๋งŒ์˜ ์œ ํ‹ธ๋ฆฌํ‹ฐ๋ฅผ ๋งŒ๋“ค์–ด๊ฐ€๋Š” ๊ฑธ ํ•ด๋ณด์„ธ์š”.

  • ํ•จ์ˆ˜๋ฅผ ๋ฒ”์šฉ์ ์œผ๋กœ

  • ์ธํ’‹์ด ์žˆ๊ณ  ์•„์›ƒํ’‹์ด ์žˆ๋Š” ๊ฒƒ์ด ํ…Œ์ŠคํŠธ๊ฐ€ ํŽธํ•œ ์ฝ”๋“œ

์ฐพ์•„๋ณด๊ธฐ#

  • setInterval ๋‹จ์ 

  • ์™œ setTimeout์„ ์žฌ๊ท€์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š”์ง€

  • ES ๋ชจ๋“ˆ


  • ๋ Œ๋”๋ง์„ ์ž์ฃผ ์ผ์œผํ‚ค์ง€ ๋ง์•„๋ผ

  • ํ•จ์ˆ˜๊ฐ€ ์งง์•„์„œ ์ข‹๋‹ค

  • ๊ณผ๋„ํ•  ์ •๋„๋กœ ๋‚˜๋ˆ„๋Š”๊ฒŒ ๋‚ซ๋‹ค


ES ๋ชจ๋“ˆ#

  • ํ”„๋ก ํŠธ์—์„œ๋„ import export๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

  • ๋ชจ๋“ˆ ๊ด€๋ฆฌ๋Š” ์˜์กด์„ฑ ๊ด€๋ฆฌ์ด๋‹ค.

util์€ ๋ฒ”์šฉ์„ฑ ์žˆ๋Š” ๊ฒƒ, ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง๊ณผ ๋ฌด๊ด€ํ•œ


๋ฐฑ์—”๋“œ์—์„œ ๋งค์ง๋„˜๋ฒ„๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํฌ๋ฆฌํ‹ฐ์ปฌํ•œ ์ด์Šˆ๊ฐ€ ์ƒ๊ธด๋‹ค.

ํšŒ์›๊ฐ€์ž… ๋กœ๊ทธ์ธ

โ†’ ํด๋ผ์ด์–ธํŠธ์—์„œ validation, ์„œ๋ฒ„์—์„œ validation์„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค.


๋„๊ตฌ๋ฅผ ์ดํ•ดํ•˜๊ณ  ์จ์•ผํ•œ๋‹ค.

aspective-oriented programming#


์‹ค์ œ๋กœ ์ค‘์š”ํ•œ๊ฑด ์œ ์ง€ ๋ณด์ˆ˜, hotfix๊ฐ€ ์ž์ฃผ ์ผ์–ด๋‚œ๋‹ค.


ยท ์•ฝ 3๋ถ„

ํŒ€ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•ด...#

์Šคํ”„๋ฆฐํŠธ ํšŒ์˜#

  • ํŒ€์˜ ๋ชฉํ‘œ ์ˆ˜๋ฆฝ, ์œ„ํ‚ค ๋“ฑ๋ก

  • ๊ฐœ๋ฐœํ•ด์•ผ ํ•  ๋‚ด์šฉ์„ feature ๋‹จ์œ„๋กœ ์ถ”๋ฆฌ๊ณ  issue ํ•ญ๋ชฉ์— ๋“ฑ๋ก

์Šคํฌ๋Ÿผ#

  • ์ƒํƒœ, ์–ด์ œ ํ•œ ์ผ, ์˜ค๋Š˜ ํ•œ ์ผ์„ 5๋ถ„ ๋‚ด๋กœ ์งง๊ฒŒ ์ด์•ผ๊ธฐ

  • ์„œ๋กœ์˜ ๊ฑด๊ฐ•, ์‹ฌ๋ฆฌ, ๊ฐœ๋ฐœ ์ง„ํ–‰ ์ƒํƒœ๋ฅผ ๋‚˜๋ˆ„๊ณ  ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•จ

  • ๊ฒฐ๊ณผ๋ฅผ ์œ„ํ‚ค์— ๋งค์ผ ์ž‘์„ฑ

๋ฐ๋ชจ#

๋ฏธ๋‹ˆ ์„ธ๋ฏธ๋‚˜#

ํŒ€ ์ฃผ๊ฐ„ ํšŒ๊ณ #

  • ์„œ๋กœ ๊ฒฉ๋ คํ•˜๊ณ  ํ”ผ๋“œ๋ฐฑ ๋‚˜๋ˆ„๋ฉฐ ํ•จ๊ป˜ ์„ฑ์žฅํ•˜๊ธฐ

  • ์ด๋ฒˆ ์ฃผ์— ์ž˜ํ•œ ์ , ์•„์‰ฌ์šด ์ 

๋ฐฐ๋ฏผ์ƒํšŒ ๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž… ํŽ˜์ด์ง€ ๊ตฌํ˜„#

๊ทธ๋ผ์šด๋“œ ๋ฃฐ#

๊นƒ ์…‹์—…#

๋ธŒ๋žœ์น˜#

์ผ€๋ฐฅ ์ผ€์ด์Šค

  • master

  • develop

  • frontend

  • backend

  • feature/issue-#

  • document

ํŒŒ์ผ๋ช… / ํด๋”๋ช…#

์ผ€๋ฐฅ ์ผ€์ด์Šค

  • ์ปค๋ฐ‹ - ํƒ€์ž…๋ณ„ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€ ๋จธ๋ฆฟ๋ง ๋ถ™์ด๊ธฐ

  • git add . , git commit -m "" ์ตœ๋Œ€ํ•œ ์ž์ œํ•ด๋ณด๊ธฐ

ex) [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]

์ปจ๋ฒค์…”๋„ ์ปค๋ฐ‹์„ ์ฐธ์กฐํ•จ.

Conventional Commits

PR ๋ฐฉ์‹#

  • ๋‚ด๊ฐ€ ๋ณด๋‚ธ PR์€ ์ƒ๋Œ€๋ฐฉ์ด Squash and Merge ํ•˜๊ธฐ

์ด์Šˆ๋กœ ๋‚˜๋ˆ„๊ธฐ#

GitHub๋กœ ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌํ•˜๊ธฐ Part1 - ์ด์Šˆ ๋ฐœ๊ธ‰ ๋ถ€ํ„ฐ ์ฝ”๋“œ๋ฆฌ๋ทฐ๊นŒ์ง€ | Popit

์œ„ํ‚ค#


๊ธฐ๋Šฅ ๋ช…์„ธํ™”#

ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ๋ฐฉ๋ฒ•#

์›”์š”์ผ

ํ™”์š”์ผ - ๋ชฝ์ดŒํ† ์„ฑ์—ญ ํฐ์ง‘ 11์ธต, 9์‹œ

์ˆ˜์š”์ผ, ๋ชฉ์š”์ผ - ๋ฒ”๊ณ„์—ญ ์Šคํƒ€๋ฒ…์Šค, 9์‹œ

๋ชฉ์š”์ผ ์™„์„ฑ์„ ๋ชฉํ‘œ๋กœ, ๊ธˆ์š”์ผ ์˜ค์ „์—๋Š” ๋ฌธ์„œ ์ •๋ฆฌ๋‚˜, ๋ฆฌํŒฉํ† ๋ง ์ •๋„๋งŒ

๊ธˆ์š”์ผ ์˜ค์ „ 11์‹œ๊นŒ์ง€


๋ฐฐ๋ฏผ์ƒํšŒ ํšŒ์›๊ฐ€์ž…/๋กœ๊ทธ์ธ#


  1. ์•„์ด๋”” input