Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Monday, 17 August 2015

Javascript Object Method

Object Methods

In addition to properties, objects can have methods. An object’s method is a function it can perform. Let’s take a look at this example. For this one, let’s create a Circle object. First, we’re going to have to define our functions, and then make them methods of our Circle object. Let’s define our Circle() constructor and a Circle object or two:

function Circle(radius){  

  this.radius = radius;  

}  

  

var bigCircle = new Circle(100);  

var smallCircle = new Circle(2);

 

Subscribe to our Newsletter

Contact our Support

Email us: youremail@gmail.com

Our Team Memebers