From c738a2844c39826f491de4c34a07c76f00b855cb Mon Sep 17 00:00:00 2001 From: Jozias Martini Date: Thu, 1 Sep 2022 20:08:03 -0300 Subject: [PATCH] Update this keyword in JavaScript roadmap (#1660) --- .../content/111-javascript-this-keyword/readme.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/content/roadmaps/106-javascript/content/111-javascript-this-keyword/readme.md b/content/roadmaps/106-javascript/content/111-javascript-this-keyword/readme.md index a87b4c397..c706f9142 100644 --- a/content/roadmaps/106-javascript/content/111-javascript-this-keyword/readme.md +++ b/content/roadmaps/106-javascript/content/111-javascript-this-keyword/readme.md @@ -1 +1,14 @@ -# Javascript this keyword \ No newline at end of file +# This Keyword + +In JavaScript, the `this` keyword is a little different compared to other languages. It refers to an object, but it depends on how or where its being invoked. It also has some differences between strict mode and non-strict mode. + +- In an object method, `this` refers to the object +- Alone, `this` refers to the global object +- In a function, `this` refers to the global object +- In a function, in strict mode, `this` is undefined +- In an event, `this` refers to the element that received the event +- Methods like call(), apply(), and bind() can refer `this` to any object + +The JavaScript `this` Keyword +This Keyword +