<script>
function MyClass(msg) {
this.message = msg;
}
var my = new MyClass("hello ");
my.message;
//ここまでが状態の保持
MyClass.prototype.greet = function(to) {
var private = 1;
console.log(this.message + to);
};
my.greet("oop!");
//状態の参照
</script>
1 Response
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.