🚨 JavaScript Interview Question What will be the output? const obj = { name: "Frontend", regularFunc: function () { console.log(this.name); }, arrowFunc: () => { console.log(this.name); } }; obj.regularFunc(); obj.arrowFunc(); Both functions are inside the same object. But the output is different. This question tests understanding of: • this binding • Arrow functions vs regular functions • Execution context in JavaScript Many developers assume both will print the same value. What do you think the output will be? #JavaScript #FrontendInterview #ReactJS #FrontendDeveloper #JavaScriptConcepts #ProductBasedCompany
Frontend (because of the value of this inside a regular function depends on how the function is called.) undefined (Arrow functions do not have their own this.)
What's the output, I am confused Suman Yadav