KUNGFU TECH

Tài nguyên
Kungfu Quiz NEW
Đăng nhậpĐăng ký
🇻🇳
Câu hỏi phỏng vấnCâu hỏi phỏng vấn Javascript

Câu hỏi

Kết quả đoạn code sau là gì?

class Dog {
   constructor(name) {
     this.name = name;
   }
 }

 Dog.prototype.bark = function () {
   console.log(`Woof I am ${this.name}`);
 };

 const pet = new Dog("Mara");

 pet.bark();

 delete Dog.prototype.bark;

 pet.bark();
  • A: "Woof I am Mara", TypeError
  • B: "Woof I am Mara","Woof I am Mara"
  • C: "Woof I am Mara", undefined
  • D: TypeError, TypeError

Câu trả lời

Đáp án: A

Chúng ta có thể xóa các thuộc tính khỏe object bằng từ khóa delete, kể cả với prototype. Khi chúng t...

Bạn cần đăng nhập để xem

Gợi ý câu hỏi

Sự khác biệt giữa Map và WeakMap trong ES6 là gì?

Sự khác nhau giữa Anonymous function và Named function là gì?

Kết quả đoạn code sau là gì?

class Chameleon {
    static colorChange(newColor) {
      this.newColor = newColor;
      return this.newColor;
    }

    constructor({ newColor = "green" } = {}) {
      this.newColor = newColor;
    }
  }

  const freddie = new Chameleon({ newColor: "purple" });
  freddie.colorChange("orange");
  • A: orange
  • B: purple
  • C: green
  • D: TypeError

Kết quả đoạn code sau là gì?

function compareMembers(person1, person2 = person) {
    if (person1 !== person2) {
      console.log("Not the same!");
    } else {
      console.log("They are the same!");
    }
  }
  const person = { name: "Lydia" };
  compareMembers(person);
  • A: Not the same!
  • B: They are the same!
  • C: ReferenceError
  • D: SyntaxError

Bạn nghĩ gì về AMD (Asynchronous Module Definition) và CommonJS?

Nếu bạn đuổi theo công nghệ, thế giới sẽ theo bạn

Trang chủKhóa họcTài nguyên
Điều khoản và Dịch vụCác câu hỏi thường gặpChính sách bảo mậtDMCA.com Protection Status

KUNGFU TECH

@ 2023 Copyright

#techmely#kungfutech#thaycacac