Câu hỏi
Kết quả đoạn code sau là gì?
const user = {
email: "my@email.com",
updateEmail: (email) => {
this.email = email;
},
};
user.updateEmail("new@email.com"); console.log(user.email);
- A:
my@email.com
- B:
new@email.com
- C:
undefined
- D:
ReferenceError
Đáp án: A
Hàm updateEmail
là một cú pháp arrow function ...