-
Notifications
You must be signed in to change notification settings - Fork 0
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
[25장] 클래스 - 1 #22
Labels
Comments
Q. 아래의 문항은 클래스에서 정의한 메서드의 특징입니다. 이중 틀린 문장을 찾고 바르게 고쳐보세요.
정답4. 클래스에서 정의한 메서드는 열거 불가능이다. 따라서 문장을 올바르게 고치면for ...in 문이나 Object.keys 메서드 등으로 열거할 수 [없다]. 즉, 프로퍼티의 열거 가능 여부를 나타내며, 불리언 값을 갖는 프로퍼티 어트리뷰트 [[Enumerable]]의 값이 [false]다. 5. 클래스에서 정의한 메서드는 new 연산자와 함께 호출할 수 없는 non-constructor다. 따라서 문장을 올바르게 고치면 내부 메서드 [[Construct]]를 갖지 않는 non-constructor다. 따라서 new 연산자와 함께 호출할 수 없다. |
Q. 생성자 함수로 작성된 코드를 클래스로 변경하려고 합니다. 그런데 틀린 곳이 한 군데 있다네요. 생성자 함수 코드와 똑같이 동작하도록 틀린 곳을 바로 고쳐주세요. 그 부분만 작성해주시면 됩니다..! const Gunwoo = (function(){
function Gunwoo(name) {
this.name = name
this.age = 24
}
Gunwoo.prototype.playGame = function () {
console.log('롤 재밌당')
}
Gunwoo.readBook = function () {
console.log('재미없다')
}
return Gunwoo
}()) class Gunwoo {
age = 24
constructor(name) {
this.name = name
}
playGame() {
console.log('롤 재밌당')
}
readBook() {
console.log('재미없다')
}
} 퀴즈 정답static readBook() {
console.log('재미없다')
} |
Q. 다음은 private 필드에 대한 설명입니다. 문장의 빈 칸을 채워주세요.
퀴즈 정답
1. 클래스 내부 2. 접근자 프로퍼티 3. 클래스 몸체
|
Merged
Q. OX 퀴즈
퀴즈 정답
|
Q. 다음 코드의 출력 결과를 작성해주세요 const Frong = '나는야 프롱이';
{
console.log(Backdung); // (1)
console.log(Student) // (2)
console.log(Frong); // (3)
class Frong {}
var Backdung = class Student {};
} 퀴즈 정답
(1) undefined
(2) Student is not defined
(3) ReferenceError: Cannot access 'Frong' before initialization
|
Q. OX퀴즈
퀴즈 정답
정답 설명
1. X: 클래스는 함수이며 기존 프로토타입 기반 패턴을 클래스 기반 패턴처럼 사용할 수 있도록 하는 문법적 설탕이다. 2. X: 클래스는 new연산자 없이 호출되면 에러가 발생하지만 생성자 함수는 new연산자 없이 호출하게 되면 일반함수로서 호출된다. 3. X: constructor는 클래스 내에 한 개만 존재할 수 있지만 생략도 가능하다. 4. O |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
데브코스 4기 프롱이들 모던 JS Deep Dive 책 뿌수기😎
아래 템플릿을 복사해서 1개이상 퀴즈를 만들어주세요. 객관식, 주관식, 단답형 모두 상관없습니다!
The text was updated successfully, but these errors were encountered: