Skip to content

Instantly share code, notes, and snippets.

@regepan
Last active December 30, 2015 07:59
Show Gist options
  • Save regepan/7799924 to your computer and use it in GitHub Desktop.
Save regepan/7799924 to your computer and use it in GitHub Desktop.
// コンストラクタ
function Circle(){}
// インスタンスメソッド
Circle.prototype.area = function(val){ alert(val) };
// インスタンスを生成する
var c = new Circle();
/**
* ここから検証
*/
// コンストラクタ
console.debug(Circle.area);// undefined
console.debug(Circle.prototype.area);// function()
Circle.prototype.area('コンストラクタ!');// コンストラクタ!
// インスタンス
console.debug(c.area);// function()
console.debug(c.prototype);// undefined
c.area('インスタンス!');// インスタンス!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment