1 | 'use strict'; |
||
2 | require('../../dist/joii.min.js'); |
||
3 | |||
4 | /** |
||
5 | * Demonstrate a simple use of private properties and methods. |
||
6 | */ |
||
7 | var MyClass = Class({ |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
8 | |||
9 | 'private some_property' : 'Hi there.', |
||
10 | |||
11 | 'private someMethod' : function () { |
||
12 | return this.some_property; |
||
13 | }, |
||
14 | |||
15 | 'public anotherMethod': function () { |
||
16 | return this.someMethod(); |
||
17 | } |
||
18 | |||
19 | }); |
||
20 | |||
21 | var a = new MyClass(); |
||
22 | |||
23 | // Prints "undefined". |
||
24 | console.log(typeof a.someMethod); |
||
25 | console.log(typeof a.some_property); |
||
26 | |||
27 | // Prints "Hi there." |
||
28 | console.log(a.anotherMethod()); |
||
29 |