Determining what this is is actually rather simple. The overarching rule is that this is determined at the time a function is invoked by inspecting where it’s called, its call site. It follows these rules, in order of precedence.
⏱ 4 min read
🔘 #JS
⏱ 4 min read
🔘 #JS
Medium
The Simple Rules to ‘this’ in Javascript
A few rules determine what the 'this’ keyword is inside a function
To explain what new does, let’s start with just a normal function, called without new. We want to write a function that will create “person” objects. It’ll give these objects name and age properties based on parameters that it takes in.
⏱ 4 min read
🔘 #JS
⏱ 4 min read
🔘 #JS
Medium
Javascript’s “new” Keyword Explained as Simply as Possible
Normal Function Call