Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 303 Bytes

File metadata and controls

23 lines (15 loc) · 303 Bytes

importance: 5


"this" w obiektach

Poniższa funkcja makeUser zwraca obiekt.

Jaki będzie rezultat dostępu do jego ref? I dlaczego?

function makeUser() {
  return {
    name: "John",
    ref: this
  };
};

let user = makeUser();

alert( user.ref.name ); // Jaki będzie wynik?