W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더). - Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외) - Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체) - Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속) 각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.3 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| javascript-object-this | JavaScript Object this | Frontend | draft | conceptual |
|
B | 0.88 | 2026-06-23 | 2026-06-23 |
|
|
JavaScript Object this
🎯 한 줄 통찰 (One-line insight)
this refers to the object calling a method — inside an object method it is that object, but used alone or in a regular function it refers to the global object. [S1]
🧠 핵심 개념 (Core concepts)
thisrefers to an object — it is used to access the object that is calling a method. [S1]- In an object method,
thisis the object — it lets the method access the object's properties. [S1] - Reusable methods —
thismakes it possible to use the same method with different objects. [S1] thisalone is the global object — in a browser that is thewindowobject; in strict mode it isundefined. [S1]- In a regular function,
thisis the global object too. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Shared-method pattern — define the same
hello()method on multiple objects so each resolvesthis.nameto its own value. [S1] - Property access via
this—this.firstName/this.lastNamereach own properties from within a method. [S1]
📖 세부 내용 (Details)
this in Objects
The this keyword refers to an object. In JavaScript, this is used to access the object that is calling a method. [S1]
this in an Object Method
When used inside an object method, this refers to the object. [S1]
const person = {
firstName: "John",
lastName: "Doe",
age: 50,
fullName: function() {
return this.firstName + " " + this.lastName;
}
};
Here this.firstName refers to the firstName property of the person object, and this.lastName refers to the lastName property. [S1]
Why Use this?
The this keyword makes it possible to use the same method with different objects. [S1]
const person1 = {
name: "John",
hello: function() {
return "Hello " + this.name;
}
};
const person2 = {
name: "Anna",
hello: function() {
return "Hello " + this.name;
}
};
document.getElementById("demo").innerHTML = person1.hello();
this Alone
When used alone, this refers to the global object. In a browser, the global object is the window object. In strict mode, this is undefined when used alone. [S1]
let x = this;
document.getElementById("demo").innerHTML = x;
this in a Function
In a regular function, this also refers to the global object. [S1]
function myFunction() {
return this;
}
document.getElementById("demo").innerHTML = myFunction();
Summary
In an object method, this refers to the object; this lets methods access object properties; used alone, this refers to the global object. [S1]
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
| Context | What this refers to |
|---|---|
| Inside an object method | The owning object [S1] |
| Used alone | The global object (window in a browser); undefined in strict mode [S1] |
| Inside a regular function | The global object [S1] |
🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — person.fullName using this, the shared hello() method across person1/person2, and this returned alone and from a regular function. No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Same method, different objects:
const person1 = { name: "John", hello: function() { return "Hello " + this.name; } };
const person2 = { name: "Anna", hello: function() { return "Hello " + this.name; } };
this alone resolves to the global object:
let x = this;
⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source. The page notes a mode distinction: this used alone is the global object normally, but undefined in strict mode. [S1]
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.88
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: JavaScript Tutorial
- 관련 개념: JavaScript Object Methods, JavaScript Objects, JavaScript Arrow Functions
- 참조 맥락: Referenced whenever reasoning about method context, and contrasted with arrow functions, which do not bind their own
this.
📚 출처 (Sources)
- [S1] W3Schools — JavaScript Object this — https://www.w3schools.com/js/js_object_this.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Object this" page (Astra wiki-curation, P-Reinforce v3.1 format).