From 0c245858e693ee76a1f6f1d0d9c5b07b3123977d Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Wed, 12 May 2021 13:36:32 +1000 Subject: [PATCH] Module3: What is the call Method? --- app.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 872414d..8cc90ad 100644 --- a/app.js +++ b/app.js @@ -1,11 +1,7 @@ -let message = { - name: 'John', - regularFunction: function() { - console.log(this) - console.log('Hello ' + this.name); - }, - arrowFunction: () => console.log(this) -} +let person1 = {name: 'John', age: 22}; +let person2 = {name: 'Mary', age: 26}; -message.regularFunction(); -message.arrowFunction(); // \ No newline at end of file +let sayHi = function() { + console.log('Hi, ' + this.name); +}; +sayHi.call(person1); \ No newline at end of file