Here is an example on how to use classes and methods in Javascript:
1 2 3 4 5 6 7 8 9 10 11 12 |
function class1() { this.attribute1 = 0; this.attribute2 = 0; this.init = function() { this.attribute1 = 1; this.attribute2 = 1; } } var c = new class1(); c.init(); |
![Share on Facebook Facebook](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png)
![Share on Twitter twitter](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png)
![Share on Reddit reddit](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/reddit.png)
![Pin it with Pinterest pinterest](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/pinterest.png)
![Share on Linkedin linkedin](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png)
![Share by email mail](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/mail.png)