Last active
December 7, 2018 03:56
-
-
Save baobao/64c29c3d0163dd0a5740 to your computer and use it in GitHub Desktop.
JavaScriptの基本(クラスの基本)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created with JetBrains WebStorm. | |
* User: bao_bao | |
* Date: 2013/03/31 | |
* Time: 22:07 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
var Helloworld = function() | |
{ | |
console.log("hogehogefooo"); | |
// publicプロパティ | |
this.x = 0; | |
this.y = 0; | |
//========================================================= | |
// PUBLIC METHOD | |
//========================================================= | |
this.position = function(x, y) | |
{ | |
this.x = x; | |
this.y = y; | |
} | |
this.toString = function() | |
{ | |
console.log(privateMethod() + "::x:" + this.x + "::y:" + this.y); | |
} | |
//========================================================= | |
// PRIVATE METHODS | |
//========================================================= | |
var privateMethod = function() | |
{ | |
return "private method"; | |
} | |
} | |
var h = new Helloworld(); | |
h.position(30, 40); | |
h.toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment