How to show the current object with reference to the current object (this) in JavaScript

1 Answer

0 votes
const worker = {
    name: "Tom",
    print() {
        console.log(this);
    }
};

worker.print();


 
/*
run:
      
{ name: 'Tom', print: [Function: print] }
 
*/

 



answered Mar 29, 2020 by avibootz
edited Mar 29, 2020 by avibootz
...