Skip to content

Reading Snippets [47 => This] 👉

github logo ・1 min read  

"This" is used differently in JavaScript from how it is used in most other programming languages.

The five ways "This" can be used in JavaScript include:

  • In a global scope to refer to the global object

  • To refer to the global function when calling a function

  • Calling a method

  • To refer to a newly created object when calling a constructor

  • Explicit setting to the first argument of a corresponding function call

Source:JavaScript Garden

twitter logo DISCUSS
Classic DEV Post from Sep 3 '18

The case against aliases

Because this all seems way too easy

Calvin profile image
Coding for good

Hey there reader...

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️