我一直在玩骨干并试图学习它.我暂时停留在这一点上.无法弄清楚以下代码有什么问题?
render: function() {
this.$el.empty();
// render each subview, appending to our root element
_.each(this._views, function(sub_view) {
this.$el.append(sub_view.render().el); // Error on this line
});
Run Code Online (Sandbox Code Playgroud) 代码剪切下面抛出一个错误TypeError: myObj.prototype is undefined.有人能解释我为什么吗?
为什么没有prototype对new Object()与对象文本如下规定?
var myObj = {
a : "This is a",
b : "This is b"
}
myObj.prototype.c= "This is c"; // TypeError: myObj.prototype is undefined
Run Code Online (Sandbox Code Playgroud)
如果这不是有效的方法,那么我该如何实现呢?