1
Septembers 2016-02-27 02:41:27 +08:00 via Android
|
2
Septembers 2016-02-27 02:43:26 +08:00 via Android
您认真看您发的文章了吗? secret 才是私有的啊
|
3
kaiwei OP @Septembers 在 Private 那个标题下面:
This constructor makes three private instance variables: param, secret, and that. They are attached to the object, but they are not accessible to the outside, nor are they accessible to the object's own public methods. They are accessible to private methods. Private methods are inner functions of the constructor. 他说,三个都是不能 accessible to the outside 。 |
4
xcodebuild 2016-02-27 08:58:14 +08:00 via Android
@kaiwei 你访问的是 member ,不是这三个的任何一个,有任何问题么?
|
5
yuriko 2016-02-27 09:14:14 +08:00
原谅我放荡不羁的笑点……
|
6
jsonline 2016-02-27 11:19:00 +08:00 via Android
为什么要把其它语言的概念搬到 JS
|
7
jkeylu 2016-02-27 11:27:20 +08:00
ES6 中 closure + Symbol 就能实现 private 的效果
|
8
neoblackcap 2016-02-28 01:01:02 +08:00 via iPhone
@kaiwei 如 @codefalling 所说你访问的是 member ,原文只说 param, secret, that 三个变量是私有的而已
|
9
xuzicn 2016-02-28 17:36:07 +08:00
额外插一句, JS 没有 private 这一说,想要实现数据保护经常引入额外的麻烦
|