---
title: "Comment by shubham on \"[JavaScript] Deep Dive into the THIS Keyword\" | Hashnode"
description: "i think you code look wrong in this part const obj = { name: &quot;John Doe&quot;, myFunc() { printNmae: () =&gt; { console.log(this.name); } }, }; obj.printNam"
url: "https://hashnode.com/posts/javascript-deep-dive-into-the-this-keyword/6467f1877b8b42fe31319926/comment/6468696105373f00453b03a8"
---

[Discussion](https://hashnode.com/posts/javascript-deep-dive-into-the-this-keyword/6467f1877b8b42fe31319926)

Comment [\[JavaScript\] Deep Dive into the THIS Keyword](https://hashnode.com/posts/javascript-deep-dive-into-the-this-keyword/6467f1877b8b42fe31319926)

[shubham](https://hashnode.com/@shubham346)

[May 20, 2023](https://hashnode.com/posts/javascript-deep-dive-into-the-this-keyword/6467f1877b8b42fe31319926/comment/6468696105373f00453b03a8)

i think you code look wrong in this part

const obj = { name: "John Doe", myFunc() { printNmae: () => { console.log(this.name); } }, }; obj.printName() // ''

you can't access the printNmae , for accessing the printNmae you have to return it. just do

const obj={ name:"John Doe", myFunc(){ return { printNmae:()=>{console.log(this.name)} } } } obj.myFunc().printNmae();

[Lim Woojae](https://hashnode.com/@jaylog)

[May 20, 2023](https://hashnode.com/posts/javascript-deep-dive-into-the-this-keyword/6467f1877b8b42fe31319926/comment/6468696105373f00453b03a8#reply-6468e5ae689ece0aeed07ea8)

Got it :) thank you for pointing it out!
