相关疑难解决方法(0)

在Javascript中,这个下划线是什么意思?

var Gallery = Backbone.Controller.extend({
    _index: null,
    _photos: null,
    _album :null,
    _subalbums:null,
    _subphotos:null,
    _data:null,
    _photosview:null,
    _currentsub:null,
    routes: {
        "": "index",
        "subalbum/:id": "subindex",
        "subalbum/:id/" : "directphoto",
        "subalbum/:id/:num" : "hashphoto"
    },
    initialize: function(options) {
        var ws = this;
        if (this._index === null){
            $.ajax({
                url: 'data/album1.json',
                dataType: 'json',
                data: {},
                success: function(data) {
                    ws._data = data;
                    ws._photos =
                    new PhotoCollection(data);
                    ws._index =
                    new IndexView({model: ws._photos});
                    Backbone.history.loadUrl();
                }
            });
            return this;
        }
        return this;
    },
    //Handle rendering the initial view for the
    //application
    index: function() …
Run Code Online (Sandbox Code Playgroud)

javascript oop backbone.js

81
推荐指数
3
解决办法
5万
查看次数

nodeJS中的双下划线与单下划线

我在使用 nodeJS 时遇到了 2 个相互冲突的命名约定。有些变量以单个下划线开头,例如_temp,而有些变量以双下划线开头,例如__dirname

我一直试图寻找这个命名约定差异的答案。我在变量前检查了双下划线,但答案非常具体到__dirname__filename。它没有解决冲突的命名约定。

如果有人可以为此提供资源,那就太好了。

javascript naming-conventions node.js

4
推荐指数
2
解决办法
4985
查看次数