Archive
This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
JavaScript Static Properties and Methods
Sep 28, 2016ProgrammingComments (0)
Here is a very simple example on using static properties and methods (variables and functions) with JavaScript.

// Create your class
function TestClass() {}

// A static property
TestClass.staticProperty = "Testing";

// A static method
TestClass.staticMethod = function() {
console.log(TestClass.staticProperty);
};

// Test it
TestClass.staticMethod();
Comments (0)
Add a Comment
No comments yet