A Pen by YY

Thumbnail
This awesome code was written by YingYing, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright YingYing ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/YingYing/a-pen-by-yy-dezMBd */
    


/*Downloaded from https://www.codeseek.co/YingYing/a-pen-by-yy-dezMBd */
    var john = {
    name: 'John',
    yearOfBirth: 1990,
    calculateAge: function() {
        console.log(this);
        console.log(2018 - this.yearOfBirth);

       /* function innerFunction () {
            console.log(this);
        }
        innerFunction();*/
    }
}

john.calculateAge(1995);

var mike = {
    name: 'Make',
    yearOfBirth: 1984
};

mike.calculateAge = john.calculateAge;
mike.calculateAge();

Comments