This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS Functions

In this example the fulllName method of person is applied on person1:

const person = {
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
};

const person1 = {
  firstName:"John",
  lastName: "Doe"
};

document.getElementById("demo").innerHTML = person.fullName.apply(person1);