javascript-tutorial / javascript-tutorial/ko.javascript.info
[오타수정] 9.1 클래스와 기본 문법 getter와 setter 파트 오타 수정
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2k
- Forks
- 852
- PR merge metrics
- No merged PRs in 30d
Description
원문
오타수정
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였습니다!
소중히 생각하는 자료에 기여를 할 수 있다면 너무나 영광일 것 같습니다!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the Korean tutorial's chapter 9.1 example covering getters and setters, then inspect the constructor call and the value.length < 4 condition shown in the issue. Change the short sample name so the example reaches alert(user.name), and verify the rendered example displays the expected name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100