1 | 'use strict'; |
||
2 | require('../../dist/joii.min.js'); |
||
3 | |||
4 | /** |
||
5 | * Demonstrates a simple class containing a numeric property and a method that |
||
6 | * adds a value to the numeric property. |
||
7 | */ |
||
8 | var MyClass = Class({ |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
9 | |||
10 | some_number : 42, |
||
11 | |||
12 | /** |
||
13 | * Adds the given number to 'some_number'. |
||
14 | * @param number |
||
15 | */ |
||
16 | add: function (number) { |
||
17 | this.some_number += number; |
||
18 | } |
||
19 | }); |
||
20 | |||
21 | var a = new MyClass(); |
||
22 | |||
23 | // Print the current value to the screen. The expected result is 42. |
||
24 | console.log(a.getSomeNumber()); |
||
25 | |||
26 | // Add a number to it. |
||
27 | a.add(10); |
||
28 | |||
29 | // Print it again. The new output is 52. |
||
30 | console.log(a.getSomeNumber()); |
||
31 |