Forgot username/password? Don't have an account?
Login with Facebook
Home » Courses » Object Oriented JavaScript » Creating a JavaScript Constructor
Subscribe for updates.
* New to us? log in with Facebook and get a free day pass

Creating a JavaScript Constructor

Yes its time. Now that we created and worked with a few objects its time for us to know how to create our own objects. Constructors in JavaScript are very simple if you know what a function is then you know how to create a constructor. Now that you know its easy to create lets now talk about how to turn functions into constructors. Every function can be a constructor its that simple. Only when we actually trigger the function does javascript actually define it as that. The step involved is by calling the 'new' key. By the end of this session you will know how to create a constructor, you will know how to build objects based on this constructor and define them as a variable.

We start talking about 'this' and what it actually means. The this is not a static value it always returns to us what we are when we are in it. And as such when we call the this operator depending on where we are in our code we will get a different value returned. The nearest object we are in is always returns to us. Although we don't talk about it much at this stage pay a lot of attention to the key word this as it will help you a lot through out the course as we start in later sessions about scope.

Got A Question?

'I love being Prime'

Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now