⇤ ← Revision 1 as of 2013-07-28 00:06:36
Size: 681
Comment:
|
Size: 685
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
SpiderMonkey is Mozilla's JavaScript engine written in C/C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2. | SpiderMonkey is Mozilla's [[Javascript]] engine written in C/C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2. |
SpiderMonkey
SpiderMonkey is Mozilla's Javascript engine written in C/C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2.
Example code
1 #!/usr/bin/js
2 function CTest(){
3 this.counter=0;
4 }
5
6
7 CTest.prototype.increment=function(){
8 this.counter++;
9 };
10
11 CTest.prototype.show=function(){
12 putstr(this.counter);
13 putstr("\r\n");
14 };
15
16 var c = new CTest();
17 var d = new CTest();
18 c.increment();
19 c.increment();
20 c.increment();
21 c.show();
22
23 d.increment();
24 d.increment();
25 d.show();
Run it with:
- chmod 755 test.js
- ./test.js
SpiderMonkey is installed on Slackware 14.