class※定義,インスタンス(new class)※実行,constructor※定義,メソッド(●●(…){…})※動作の定義

//クラス「Niku」を定義
class Niku{
 constructor(kinds,grams){
  this.kinds = kinds;
  this.grams = grams;
 }
 info(){
  console.log(`肉の種類は${this.kinds}、${this.grams}グラム`);
 }
}

//「Niku」を継承したクラス「cook」を定義
class cook extends Niku{
 recipe(){
  const recipe =`焼き${nikuinfo.kinds}のために${nikuinfo.kinds}肉が${nikuinfo.grams}グラム必要`;
  console.log(recipe);
  return recipe;
 }
}

//「new」を使って「Niku」インスタンス作成(クラス「Niku」のメソッドを実行)
const nikuinfo = new Niku("鳥",100);
nikuinfo.info();

//同様に「new」を使って「cook」インスタンス作成(クラス「cook」のメソッドを実行)
const cooking = new cook();
var addtxt = cooking.recipe();

//HTML内のdiv(#demo)にテキスト出力
let demoBox = document.getElementById('demo');
demoBox.innerHTML=addtxt;