SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Object static members
-
Sep 17, 2007, 10:45 #1
- Join Date
- Jun 2004
- Location
- Mumbai
- Posts
- 447
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Object static members
Hi
Code JavaScript:function foo1() { this.m = 0; } foo1.prototype.c1 = 5; alert(foo1.c1);
Isnt there a way to create a class constant/static members ?
ThanksAnjanesh
-
Sep 17, 2007, 13:31 #2
- Join Date
- Jun 2004
- Location
- Copenhagen, Denmark
- Posts
- 6,157
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
foo1.c1 = 5;
-
Sep 17, 2007, 15:28 #3
Also, if you want to use your prototype you can create an instance for that object e.g
Code JavaScript:function foo1() { this.m = 0; } foo1.prototype.c1 = 5; var f=new foo1(); alert(f.c1); alert(f.m);
Bookmarks