<script>
function User (theName, theEmail) {
this.name = theName;
this.email = theEmail;
}
User.prototype = {
constructor: User,
changeEmail:function (newEmail) {
this.email = newEmail;
return "New Email Saved: " + this.email;
}
}
// A User
firstUser = new User("Richard", "Richard@examnple.com");
firstUser.changeEmail("RichardB@examnple.com");
</script>
このコードはここから取得しました: http://javascriptissexy.com/oop-in-javascript-what-you-need-to-know/
質問:
この行を入れる必要がありますか: constructor: User,
? この行を削除しても、まだ機能します。