Câu hỏi phỏng vấn Javascript
Câu hỏi

Kết quả đoạn code javascript sau là gì và giải thích tại sao?

Câu trả lời

javascript Copy
  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

Đáp án: B

Objec...

middle

middle

Gợi ý câu hỏi phỏng vấn

middle

Kết quả shape của đoạn code sau là gì? Hãy giải thích tại sao?

expert

JavaScript truyền tham số theo kiểu tham chiếu (pass by references) hay theo kiểu tham trị (pass by values)?

middle

Đoạn code javascript sau output là gì? Hãy giải thích tại sao?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào