JavaScript ãããã¨æ¸ãã¦ãã£ãã John Resig - JavaScript Getters and Setters ãããããã¢ã¯ã»ãµ(getter/setter)ããããªãã¸ã§ã¯ãããã¼ã¹ã«ãã¦ã var animal = { walk : function(){ alert('walk'); }, get name(){ return this._name; }, set name(name){ this._name = name; }, } æ®éã®åæã使ã£ãextendã§ãä»ã®ãªãã¸ã§ã¯ãã«ããããã£ãã³ãã¼ãããã¨ãã¦ãã function extend(target, source){ for(var prop in source) target[prop] = source[prop]; return target; } åãªãããããã£ã®å¤ã®ã³ãã¼ã¨è§£é
{{#tags}}- {{label}}
{{/tags}}