function sample(){ a=100; b=100; var sub=new g(); sub.a=a; sub.b=b; c=sub.add(); $("#memo").html(c); } class g{ add(){ this.c=this.a+this.b return this.c } }