Skip to content

Instantly share code, notes, and snippets.

@kirantemojo
Created May 13, 2016 19:59
Show Gist options
  • Save kirantemojo/d002bc09252883eb5e7fa07d8dea34cd to your computer and use it in GitHub Desktop.
Save kirantemojo/d002bc09252883eb5e7fa07d8dea34cd to your computer and use it in GitHub Desktop.
/**
* Static class - this new MyClass will create scope but with same objects and class which are static, which tells that tells being as
* a static class, it can be told as MyClass will not be `this` giving its reference to MyClass for all instances
* and can shared
*/
function MyClass()
{
function add(num1, num2) { return (num1+num2); }
function sub(num1, num2) { return (num1-num2); }
MyClass.add = add;
MyClass.subtract = sub;
return MyClass;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment