Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver2
3いいね 486回再生

What's the output? Q19 #coding #interviewquestions #programming #javascript #learnjavascript #code

Ever wondered why console.log(this === window) logs true in JavaScript? 👀

In this short, we break down a common yet tricky JavaScript interview question that tests your understanding of the this keyword and the global window object.

💡 Explanation: In the global context (outside any function), the value of this in JavaScript refers to the global object.
In browsers, the global object is window.
So when you write console.log(this === window), you're essentially checking if the current context (this) is the window — which it is in the global scope.
✅ Hence, it returns true.

But remember — this behavior can change:

Inside strict mode

Inside functions or classes

In modules

🔄 That’s why it’s important to understand context when working with this. It's not about where a function is declared — it's about how it's called.

🧠 This is one of the most commonly asked JavaScript interview questions, especially in frontend and web developer interviews. Make sure you fully understand how this behaves in different environments: browsers vs Node.js, global vs strict mode, arrow functions vs regular functions.

🧪 Want to level up your JavaScript fundamentals? Hit that like, drop a comment with your doubts or insights, and don’t forget to subscribe for more quick dev explainers!




#javascript #webdevelopment #frontendinterview #codinginterview #jsinterviewquestions #thiskeyword #windowobject #globalcontext #codingtips #learnjavascript #javascriptshorts #frontenddeveloper #softwareengineering #programmingfundamentals #developerlife #devshorts #ytshorts #codeexplained #browserjavascript

コメント