Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function Teki(){
this.hp = 100;
function Dragon(){
Dragon.prototype = new Teki;
Dragon.prototype.attack = function(){
console.log("ドラゴンの攻撃! ドラゴンのHPは"+this.hp+"だ!");
var boss = new Dragon(); //インスタンスをつくる
boss.attack(); //攻撃してもらう
ドラゴンの攻撃! ドラゴンのHPは100だ!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment