The Complete Rules to `new`
The 'new' keyword is a central part of object-oriented programming in JavaScript. This lesson will discuss how it turns a normal function into a constructor. We'll cover all of the logic that the engine inserts into our function calls when we use 'new' and how it helps us write powerful code.
We'll cover the following...
Javascript’s “new” Keyword Explained as Simply as Possible
Normal Function Call
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.
Access this course and 1400+ top-rated courses and projects.