<script type="text/JavaScript">
function Menu(name,price){
this.name = name;
this.price = price;
}
Menu.prototype.totalPrice = function(quantity){ // totalPriceという名前をつけて型を作成
return this.price * quantity; // 型の中身は「単価×個数」 個数は関数の引数に与えるかたちにした。
}
var hamburger = new Menu("ビッグマック",100);
var str = "ぷっぷは「" + hamburger.name + "」を「" + hamburger.totalPrice(5) + "」円分たべました。";
document.getElementById('a').innerHTML = str;
</script>