Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Class OOP Tutorial Intro to Object Oriented Programming

Published :
Author :
Adam Khoury
This tutorial is an introduction to creating class based code in JavaScript, also known as OOP(Object Oriented Programming). Because it is a class-less prototype-based language, special syntax is applied to your JavaScript in order to achieve OOP features that we see in languages such as C++, C#, PHP, Java, Perl, Python and more. JavaScript has no class statement for establishing your classes like other popular languages do, but we can still create class based OOP code in JavaScript. function exampleClass(){ this.property1 = 5; this.property2 = "World"; this.method1 = function(arg1){ return arg1+" "+this.property2; } } var instance1 = new exampleClass(); var instance2 = new exampleClass(); alert(instance1.method1("Hello")); instance1.property1 = 10; alert(instance1.property1); alert(instance2.property1);

Many times an application can run smoothly and complete without a class based style of code, but sometimes your application or work situation will demand it. Large scale multi-author software demands to be class-based for extensibility reasons.