好的,我们可以在 javascript 中使用私有标识符,但是受保护的标识符呢? [英] Ok, we can have private identifiers in javascript, but what about protected ones?

查看:42
本文介绍了好的,我们可以在 javascript 中使用私有标识符,但是受保护的标识符呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就这么简单,我们能否以某种方式模拟 Javascript 中的受保护"可见性?

Simple as that, can we emulate the "protected" visibility in Javascript somehow?

推荐答案

这样做:

/* Note: Do not break/touch this object */
...code...

或者一些谷歌在第一页上找到了这个:

Or a bit of google found this on the first page:

http://blog.blanquera.com/2009/03/javascript-protected-methods-and.html

这篇关于好的,我们可以在 javascript 中使用私有标识符,但是受保护的标识符呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆