-
Notifications
You must be signed in to change notification settings - Fork 0
Udemy/Ts/section5/67: getter/setter #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 작성한 커밋입니다.
Github에서 작성한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✍Udemy/Ts/section5/67: getter/setter
🔗Reference
🔥KeyWord
📝Description
lastReport
가 비어있다면 throw를 통해서 에러를 발생시킨다.strictPropertyInitialization
가 활성화가 되어 있어서 수업에서 사용하는 일반적이 방식과는 달리 전역에 정의한 객체가 생성자 함수에서도 사용이 되어야 정상적으로 동작을 한다. 단,lastReport
전역 변수를 초기화했지만 빈 배열을 전달했기 때문에 mostRecentReport를 호출하면 여전히 "No report found." 에러가 발생할 수 있다. 이에 따라setter
를 수업과는 다르게 설정을 해주어야 정상적으로 동작을 한다.lastReoprt
의 값을 부모로부터 할당 받은addReport
인자로 인가받은 값을 push하고 전역 변수에 인자로 인가받은 값을 할당해야 get에서 설정한 Error가 발생하지 않고 정상적으로 동작을 한다.📌Summary