Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

Class OOP Tutorial Intro to Object Oriented Programming

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.

thumb

JavaScript Videos

Object Oriented Programming

Class OOP Tutorial Intro to Object Oriented Programmingprototype Tutorial Add Object Methods and Properties to ClassInheritance Tutorial Object Oriented Class Programming