GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [오타수정] 9.1 클래스와 기본 문법 getter와 setter 파트 오타 수정 · Issue #1749 · javascript-tutorial/ko.javascript.info

[오타수정] 9.1 클래스와 기본 문법 getter와 setter 파트 오타 수정 #1749

New issue
Copy link
New issue
Copy link
Open
Open
[오타수정] 9.1 클래스와 기본 문법 getter와 setter 파트 오타 수정#1749
Copy link

Description

@devjaeyoon
devjaeyoon
opened on Oct 25, 2024
Issue body actions

원문

image

오타수정

class User {
  constructor(name) {
    // setter를 활성화합니다.
    this.name = name;
  }
*!*
  get name() {
*/!*
    return this._name;
  }
*!*
  set name(value) {
*/!*
    if (value.length < 4) {
      alert("이름이 너무 짧습니다.");
      return;
    }
    this._name = value;
  }
}

let user = new User("보라보라");
alert(user.name); // 보라보라

user = new User(""); // 이름이 너무 짧습니다.

이슈

현재, value.length < 4 조건이 있으므로 기존 "보라"를 인자로 전달하면 alert("이름이 너무 짧습니다.");가 실행되어 alert(user.name)이 실행돼도 undefined가 출력됩니다. 따라서, 3을 넘길 수 있는 "보라보라"로 간단하게 수정했습니다!

Pull Request(PR)를 통해 수정할 의향이 있습니까?

네! 제가 JavaScript를 공부할 때 항상 먼저 찾아보는 자료가 모던 JavaScript였습니다!
소중히 생각하는 자료에 기여를 할 수 있다면 너무나 영광일 것 같습니다!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.