DEV Community

Kaushal
Kaushal

Posted on

this keyword in JavaScript

Introduction

A function's this behave is a little bit different in JavaScript, unlike other languages.
it also work diffrently with the use of strict mode and non-strict mode.
code
In non-strict both functions calls' this point to window/object and return true.

this in function context.

Alt Text

this and object conversion

Alt Text

with bind method

Alt Text

this work differently in both Arrow and Normal function

Alt Text

Top comments (0)