O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.5 static Methods

In this section, we continue to work our way through the Point Tracker web page’s Point class definition, with a focus on the getCount and distance methods. They’re static methods, which work a bit differently than regular methods.

In the previous section, we examined the Point class’s constructor. After the constructor comes the value method. It’s the same value method that we looked at in Section 11.3. It returns a Point object’s value in the form “(x, y).” Next is the getCount method….

getCount Method

As its name implies, the getCount method returns the count property (which holds the number of Point objects). For methods that return a property, it’s standard practice to use “get” as the first word in their names. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required