我尝试学习backbone.js,并尝试简单的示例:
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello-backbonejs</title>
</head>
<body>
<script src="jquery.js"></script>
<script src="underscore.js"></script>
<script src="backbone-min.js"></script>
<script src="my4.js"></script>
</body>
</html>
JS:
(function($){
var Tweet = Backbone.Model.extend({
defaults: function(){
return {
author: 'chalist',
status: 'test'
}
}
});
var tweet = new Tweet();
console.log(tweet.get('status'));
})(jQuery);
我进入 console.log: undefined
我的错误在哪里?